Jump to content

Little help


Rosst

Recommended Posts

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.net/blah/?view=news&act=comments&id=1, thanks in advance for any help
Link to comment
https://forums.phpfreaks.com/topic/25346-little-help/
Share on other sites

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

Try:
[code]<?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);
?>[/code]
Using the above statements should tell you what is wrong.

Ken
Link to comment
https://forums.phpfreaks.com/topic/25346-little-help/#findComment-115565
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.