Hi, I have wrote a script to display pictures. The Picture information is in a table in a mysql database called 'pictures'. I am getting the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\viewpictures.php on line 18 Line 18 is marked below. I have checked my code for errors, but I cannot seem to find any. So, can anybody else find something that I can't?? btw, the line commented out is meant to be. <?php include('header.php'); require('connect.php'); if (!$con) { die('Could not connect: ' . mysql_error()); } $id = $_GET['id']; mysql_select_db($db, $con); $result = mysql_query("SELECT * FROM pictures WHERE PictureID=$id"); while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '<img src="images/' . $row[PictureID] . $row[PictureType] . '></img>'; //mysql_query("UPDATE pictures SET PictureTimesViewed=$row[PictureTimesViewed]+1 WHERE PictureID=$id"); } mysql_close($con); ?> Code (markup):
There were actually no one but it might be very useful to post the fix here to keep it as an archive for others who might still be fixing the same thing.