我正在尝试将我的mysql_connect代码转换为mysqli_connect,以下是我的代码块...我可以登录到数据库但是mysqli_fetch_array()函数必须存在一些问题...任何人都可以指导我在哪里想念它......
$con= mysqli_connect($db_host,$db_username,$db_password,$db_name);
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="SELECT username,password FROM login WHERE username='$uname' AND password='$pass'";
$result=mysqli_query($con,$sql);
$row=mysqli_fetch_array($result,MYSQLI_NUM);
printf ("%s (%s)\n",$row[0],$row[1]);
$row=mysqli_fetch_array($result,MYSQLI_ASSOC);
printf ("%s (%s)\n",$row["username"],$row["password"]);
mysqli_free_result($result);
mysqli_close($con);
但它给了我()()这个结果......
答案 0 :(得分:-1)
我认为你的查询有问题
db.query('update #01:0 add children = #02:0');
而不是使用
$sql="SELECT username,password FROM login
WHERE username='$uname' AND password='$pass'";