Log in

View Full Version : Order data starting with set primary key



JShor
01-30-2008, 04:41 PM
Hi,

I have a search form that will return results. However, I want to have the results start displaying after a certain number (from the primary key). Say for example ... I have 78 rows...I want to start with id of 24...

my code so far:


$num = $_GET['num'];

$q = $_GET['q'];

mysql_query("SELECT * FROM users WHERE td LIKE '%$q%' LIMIT $num,$snum") or die(mysql_error());

if(strlen($q) > 50) {
echo "Displaying 20 results per page";


thanks

Jas
02-19-2008, 08:02 PM
I don't know if you've figured it out already, but did you try something like:

SELECT * FROM users WHERE td LIKE '%$q%' && id >= $start LIMIT $num,$snum
Where $start is the number you want to start from?