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>'; Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.