Jump to content


Photo

Little help


  • Please log in to reply
1 reply to this topic

#1 Rosst

Rosst
  • Members
  • PipPip
  • Member
  • 29 posts

Posted 27 October 2006 - 08:12 PM

Ok, well I am trying to make comments for my news system on my site.. And I am getting this error
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/avexxon/public_html/blah/includes/news.php on line 49, and on line 49 is this code: $commentsnum = mysql_num_rows(mysql_query("select * from newscomments where news = '$_GET[id]' order by id asc limit $from, $max_results"));, you can see here: http://www.vexxon.ne...t=comments&id=1, thanks in advance for any help

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 October 2006 - 08:35 PM

When debugging code, it is much better not to nest the function calls so you can figure out what is wrong.

Try:
<?php
$q = "select * from newscomments where news = '$_GET[id]' order by id asc limit $from, $max_results";
$rs = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());
$commentsnum = mysql_num_rows($rs);
?>
Using the above statements should tell you what is wrong.

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users