NealeWeb Posted March 29, 2011 Share Posted March 29, 2011 I am simply trying to display the last 8 images from a mysql database and i am getting this error: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/aretheyh/public_html/nealeweb.com/gnew2/recent.php on line 8 Can somebody please tell me what i am doing wrong. <?php $i = 1; echo '<table border="0" cellpadding="0" cellspacing="0"> <tr>'; include("config.inc.php"); $result = mysql_query("SELECT * FROM gallery_photos ORDER BY id DESC LIMIT 8"); while($row = mysql_fetch_assoc($result)) { // Start of the loop $img = $row['".$images_dir."/tb_']; echo "<td><img src=$img></td>"; if ($i == 4) { echo '</tr><tr>'; } $i++; } echo '</tr></table>'; Link to comment https://forums.phpfreaks.com/topic/232063-warning-mysql_fetch_assoc-supplied-argument-is-not-a-valid-mysql-result/ Share on other sites More sharing options...
mikecampbell Posted March 29, 2011 Share Posted March 29, 2011 Your SQL syntax looks alright. Are you sure you haven't typoed the table or field name? echo mysql_error(); will output a more descriptive error message. Link to comment https://forums.phpfreaks.com/topic/232063-warning-mysql_fetch_assoc-supplied-argument-is-not-a-valid-mysql-result/#findComment-1193714 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.