我遇到mysql_fetch_array的问题,这是我的代码。另一件事,mysqli *函数是什么?
<?php
session_start();
include "config.php";
$conex = mysql_connect("localhost", "root");
$name = $_GET['name'];
$selected = "SELECT id,password,email,name FROM users WHERE username = '".$name."'";
$query = mysql_query($selected,$conex);
$rows = mysql_num_rows($query);
if($row = mysql_fetch_array($query))
{
$username = $row['username'];
$id = $row['id'];
$password = $row['password'];
$email = $row['email'];
}
?>
当我在WAMP上运行时,它会发生:
答案 0 :(得分:0)
“ mysql_num_rows()和 mysql_fetch_array()期望参数为资源,布尔值为”
意味着变量 $ query 的类型为'boolean'。发生这种情况是因为语句
mysql_query($ selected,$ conex)可能返回“false”结果。
检查SQL查询...