这是我的代码:
include('functions.php');
//open connection to the server
$host="localhost"; // Host name
$username="timeout7_admin"; // Mysql username
$password="cazz11"; // Mysql password
$db_name="timeout7_timeout"; // Database name
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql = "SELECT * FROM jobs WHERE status='past' AND date LIKE '2013-10%'";
$result = mysql_query($sql);
if($result == false) {
echo mysql_error();
}
while($row = mysql_fetch_array($result)) {
}
它返回此错误:
PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home4/timeout7/public_html/backend/test.php on line 16
但我不明白为什么...... $result 的价值应该是一种资源:/