mysql_fetch_assoc() - PROBLEM
I'm having a problem with a script on my site, it worked fine, then suddently it stopped. I can't find the problem because of my limited php knowledge. I hope someone can assist me, as this really annnoys the shit out of me lol.
[quote:02321fa4e7]Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/varg/public_html/maps/comment.php on line 52[/quote:02321fa4e7]
[code:1:02321fa4e7]<?php
function displayComments($id) {
/* bring db connection variable into scope */
global $dbh;
/* query for comments */
$query = "SELECT *, DATE_FORMAT(date, '%a %m-%d-%Y, %h:%i %p') AS date FROM map_comments WHERE map_id=$id";
$result = mysql_query ($query, $dbh);
echo "<BR />\n";
/* display the all the comments */
while ($row = mysql_fetch_assoc ($result)) {
echo "<table style=\"border:1px solid #96b4d6\" width=\"300\">\n";
$name = htmlentities ($row['name']);
echo "<tr><td><b>by: $name</b>&nbsp;&nbsp;on {$row['date']}</td></tr>\n";
$comment = strip_tags ($row['COMMENT'], '<a><b><i><u>');
$comment = nl2br ($comment);
echo "<tr><td>$comment</td></tr>\n";
echo "</table>\n";
echo "<BR />\n";
}
}
?>[/code:1:02321fa4e7]
line 52= while ($row = mysql_fetch_assoc ($result)) {
|