表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