开发者

sql syntax problem

开发者 https://www.devze.com 2023-01-22 08:40 出处:网络
is there something wrong with this syntax? SELECT * FROM tblcustomer WHERE uName LIKE \'%%\' AND tMonth = \'3\' ORDER BY uName ASC

is there something wrong with this syntax?

 SELECT * FROM tblcustomer WHERE uName LIKE '%%' AND tMonth = '3' ORDER BY uName ASC

i got this error.. Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given..

EDIT

include '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 = 开发者_如何学Go"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'];
 }


The problem is not with the sql, it's with the way you call mysql_fetch_array(). Try posting your php code too.


There's something wrong with your call to mysql_fetch_array(), not your query.

0

精彩评论

暂无评论...
验证码 换一张
取 消