這句話有什麼問題嗎?sql語法問題
SELECT * FROM tblcustomer WHERE uName LIKE '%%' AND tMonth = '3' ORDER BY uName ASC
我得到這個錯誤..警告:mysql_fetch_array()預計參數1是資源,給定的boolean ..
EDIT
包括 '的settings.php';
$con = connectDB();
$mo = array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
for($mm=1;$mm<13;$mm++) {
if(strtolower($mo[$mm-1])==strtolower(trim($_GET['uMonth']))) {
$xyz = $mm;
break;
} else {
$xyz = date("n");
}
}
$q = "SELECT * FROM tblcustomer WHERE uName LIKE '%" . $_GET['uName'] . "%' AND tMonth = '" . $xyz . "' ORDER BY uName ASC";
//echo $q;
//exit;
$r = mysql_query($q,$con);
while($row=mysql_fetch_array($r)) {
echo $row['uName'];
}
查詢可能由於某種原因失敗?連接錯誤,缺少表格等。這可能會導致mysql_query返回FALSE而不是結果句柄。 – 2010-10-29 16:45:07
啊是的..懂了.. :) – 2010-10-29 16:49:31