Page 1 of 1

Grabbing the last 50 entries in a database

Posted: Sat Feb 03, 2007 9:18 pm
by haptic
Hi, I'm just trying to grab the last 50 entries in a database ordered by their id number. The problem is the syntax I'm using just grabs 1-50, and I'm not sure why.


Here is my query:

Code: Select all

$query = "SELECT * FROM analyst ORDER BY id DESC LIMIT 50";
Yet it seems to order them by 'name' rather than 'id', because it is showing entries 1-50 ascending (rather than what should currently be entries 67 through 17).

Any idea what to do?

thanks...

Posted: Sat Feb 03, 2007 9:55 pm
by feyd
The query appears fine to me... are you sure the code is using it?

Posted: Sat Feb 03, 2007 10:15 pm
by haptic
whoops. A closer look at my code made me realize that it wasn't running that query, the problem appears to be solved. Sorry for wasting your time, and thanks for your help.