Hi all. I am having a problem I've not encountered before. When using mysql_fetch_assoc() in while(), I am getting the following error:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in archives.php on line 81
However, when taking it out of the while(), it works fine. The following is the code snippet...
$query = "SELECT * FROM comments WHERE archive_id = '$archive_id'";
$result = mysql_query($query);
while ( $result = mysql_fetch_assoc($result) ) {
$date = $result["date"];
$name = $result["name"];
$comments = $result["comments"];
echo "$date, $name, $comments";
}
I have checked database connections, I've run the query through phpMyAdmin, and checked for spelling/syntax errors.
Any ideas? Thanks!