Page 1 of 1

pulling the last 5 records from the db and counting number

Posted: Fri Sep 05, 2003 5:16 am
by gasoga
Hi ,

i am having trouble with pulling the last five records that a user submits to the database , i was wondering if anybody could tell me how do i pull the last 5 records that a user submits to the database , and then check to see if there is a value in certain coulems of each record??!!!
Any advice woudl be much appreciated!

Posted: Fri Sep 05, 2003 5:25 am
by JayBird
Okay,

not gonna tell you how to do it, but will give you some guidlines.

Construct a query to count total number of rows, using COUNT().

Then, create a query using LIMIT. subtract 5 from total number of rows in DB and LIMIT the result from that number to the maximum number.

Mark

Posted: Fri Sep 05, 2003 8:57 am
by JAM
Or (more guidelines) select using 'order by date desc' and LIMIT 5...
Depends on how the table is setup.