开发者

mysql_fetch_array (MYSQL)

开发者 https://www.devze.com 2023-02-17 02:04 出处:网络
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

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

精彩评论

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