smti Posted March 15, 2009 Share Posted March 15, 2009 Hi, I am trying to execute the following query and receive the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bloomair/public_html/indexA.php on line 168 Here is my code: <? include("includes/newsconnection.inc.php");?> <? // Retrieve data from database $sql="SELECT * FROM $tbl_name limit 1"; $result=mysql_query($sql); // Start looping rows in mysql database. while($rows=mysql_fetch_array($result)){ ?> <b><? echo $rows ['timestamp'];?> - <? echo $rows ['title'];?></span><br></b> <? echo $rows ['story']; ?> <br> <a href="pages/news/">View All Notams ></a> <br><br> <? // close while loop } // close connection mysql_close(); ?> Any help you can provide would be greatly appreciated. Thank You, -smti Link to comment https://forums.phpfreaks.com/topic/149557-mysql-fetch-array-warning/ Share on other sites More sharing options...
Mchl Posted March 15, 2009 Share Posted March 15, 2009 This warning usually means, that there your query did not complete successfully. Change: $result=mysql_query($sql); to $result=mysql_query($sql) or die(mysql_error().": $sql"); this will display the actual SQL error and the query that causes it. And please use tags for posting your code. Link to comment https://forums.phpfreaks.com/topic/149557-mysql-fetch-array-warning/#findComment-785389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.