On Wednesday 22 May 2002 09:27, Todd Williamsen wrote: > I get an invalid argument when trying to create this output of pages to > limit to 20 records per pages. I removed the line and it stopped the > error, but the next and previous buttons will go on and on even if there is > no more records so I am thinking it is my mysql_num_rows() function > > I have gotten this script from here: > > http://www.phpbuilder.com/columns/rod20000221.php3 > > If you know of a better one or can help me out on this one, that is much > appreciated > > Actual error is: > > not a valid mySQL result resource
General tips: 1) Liberal use of mysql_error() at strategic points in your code will help in identifying where the problem lies. 2a) Printing the query (in your case $sql) that you're giving mysql allows you to spot any obvious errors. 2b) If you don't spot any obvious errors then copy and paste the contents of $sql into the mysql command-line and execute it there. > <?php > > $numresults = mysql_query("SELECT * FROM booklist"); > $numrows = mysql_num_rows($numresults); > < ---------------------------------------- FAILS HERE > // next determine if offset has been passed to script, if not use 0 If that is the start of your code then the obvious mistake is that there is no code to connect to mysql and initialise the connection etc. -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* A journey of a thousand miles must begin with a single step. -- Lao Tsu */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php