PHP错误mysql_fetch_array():提供的参数不是有效的MySQL结果资源

时间:2013-01-25 00:25:13

标签: php mysql

我陷入了一个非常基本的SQL查询脚本。 Mybe有人可以注意到我无法看到的东西。我已经检查过从mysqladmin执行sql查询工作正常:

 <?
 include ('gps_db_connect.php'); 
 $query = "SELECT * from gps WHERE server_time > '20130124'";
 echo $query;
 $result = mysqli_query($connection, $query) or die(' Error getting data'); 
 echo '    After query';
 while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
  {   
   echo $row['server_time'];
  }

 ?>

这是屏幕显示/输出:

SELECT * from gps WHERE server_time > '20130124' After                      
query
PHP Error Message 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a9440109/public_html/test.php on line 7

1 个答案:

答案 0 :(得分:0)

试试这个

 $result = mysql_query($query, $connection) or die('Error');