Hey there, im not very great at php and im wondering how i could fix this error

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home2/blindst/public_html/forumbeta/vtopic.php on line 328
No replys to this topic.

This is line 328

$sql2=("SELECT * FROM `reply` WHERE tid = '$id' ORDER by id LIMIT $from, $div");
$query2=mysql_query($sql2);
$num1=mysql_num_rows($query2);

$num1=mysql ect ect is line 328 any help is much apreicated.

You're mysql query isnt a valid one, first off, at the end of querys you should get use to doing this:

mysql_query(blah) or die(mysql_error());

That will tell you if the query doesn't work.

Really, without seeing your table there isnt much that I can tell you to fix, just check all your names and do what I said above. Also, it doesn't hurt to echo $query2 to find out what it says inside that, if it's not a valid pointer your sql will fail. Try messing around with what I said a little and if it still doesn''t help, come back.

Oh also, at the top of your put this:

error_reporting ( E_ALL);

That will help in deciding on what the errors specifically are.

I got a different error when i took at $div and it said syntax error in the sql

What's the error say specifically?

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-30, 30' at line 1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.