表Users
包含数据但仍显示Records Not Found
的mysql_query不返回数据
<?php
$conn = mysql_connect("localhost", "root", "pass", "Assign1");
$records = mysql_query($conn, "select * from Users");
if(!$records)
{
echo "No Records Found";
exit();
}
while($row = mysql_fetch_array($records))
{
echo $row['name'] . " " . $row['pwd'];
echo "<br />";
}
mysql_close($conn);
?>
您正在使用[**的**过时的数据库API(HTTP:/ /stackoverflow.com/q/12859942/19068),并应使用[现代替换](http://php.net/manual/en/mysqlinfo.api.choosing.php)。 – Quentin 2013-04-22 10:34:52
检查记录计数是这样的:if(mysql_num_rows($ records)== 0) – itsols 2013-04-22 10:35:06