开发者

mysql_fetch_array (MYSQL)

I开发者_运维百科'm a beginner and I have a error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\VertrigoServ\www\index.php on line 35

and the code...

$sresult = mysql_query("SELECT code, location FROM banners");
while ($row_s = mysql_fetch_array($sresult))
{
    $banner[$row_s["location"]]=$row_s["code"];
}


Try this

$sresult = mysql_query("SELECT code, location FROM banners");
if (!$result) {
    die('Invalid query: ' . mysql_error());
}
while ($row_s = mysql_fetch_array($sresult))
{
    $banner[$row_s["location"]]=$row_s["code"];
}

And check what the error is.


Something is wrong with the query. try:

$result = mysql_query("..");
if(!$result){
  echo "Query error: " . mysql_error();
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜