Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-12-2005, 02:39 AM
varg
Unregistered

Posts: n/a

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 **** 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>  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)) {
Reply With Quote
  #2  
Old 01-13-2005, 09:33 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922

I see no reason asd to why that dosent work. Try changing mysql_fetch_assoc to mysql_fetch_array
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #3  
Old 01-16-2005, 12:39 PM
varg
Unregistered

Posts: n/a

The problem has been sorted out. There was a problem with the $id not being transferred from the links to the script properly. thanks for the help anyway.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
a little problem ... VooDoo- Tech Support 2 03-09-2008 11:28 PM
Problem? TitaN-R2K Tech Support 8 08-10-2007 05:48 PM
Same problem Leonin phphq.Net Forums 0 01-27-2005 12:53 AM
problem .ringer. Sigs and Graphics 5 06-17-2004 03:19 PM
problem here BOne Tech Support 1 08-22-2003 01:00 PM


All times are GMT -5. The time now is 07:59 PM.




Powered by vBulletin®