如何使用等于查询? [英] How to use equal for query?

查看:58
本文介绍了如何使用等于查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对呼叫程序的查询

i想要使用准备这样做。

我该怎么做?



查询:



i uesd query for Call procedure
i want to use prepare for do this.
how should i do this?

with query :

if($con = mysqli_connect("localhost", "root", $pass))
		{
			mysqli_select_db($con, "toggery");
			mysqli_set_charset($con, "utf8");
			$p = $con->query("CALL Select_State()");
			echo"<select name='sel1'>";
		while($row = mysqli_fetch_array($p, MYSQLI_ASSOC))
		{
			echo"<option value='$row[StateID]'>$row[Name]</option>";
		}		
			echo"</select>";	
		if(isset($_POST['sbm']))
		{
			echo $s = $_POST['sel1'];
		}
		}		
		else
		{
			echo 'db error!';
		}



准备:


with prepare :

if($con = mysqli_connect("localhost", "root", $pass))
		{
			mysqli_select_db($con, "toggery");
			mysqli_set_charset($con, "utf8");
			$p = $con->prepare("CALL Select_State()");
			$p->execute();
			echo"<select name='sel1'>";
		while($row = mysqli_fetch_array($p, MYSQLI_ASSOC))
		{
			echo"<option value='$row[StateID]'>$row[Name]</option>";
		}		
			echo"</select>";	
		if(isset($_POST['sbm']))
		{
			echo $s = $_POST['sel1'];
		}
		}		
		else
		{
			echo 'db error!';
		}





我的尝试:



没发生任何事情!

没有错误!

但是查询它确实有效!



What I have tried:

not thing happened!
no error!
but with query it works true!

推荐答案

con = mysqli_connect( localhost root
con = mysqli_connect("localhost", "root",


pass))
{
mysqli_select_db(
pass)) { mysqli_select_db(


con, toggery);
mysqli_set_charset(
con, "toggery"); mysqli_set_charset(


这篇关于如何使用等于查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆