PDA

View Full Version : How to call a specific row with PHP


tux
07-09-2008, 12:22 PM
Hi all,

I want to call a specific row in a DB without reference to any ID or identifier in the DB.

Example, my query looks in the DB for everything with CatID and then I need to pick just one row in that Cat but counting down a specific number of rows instead of looking for a specific ID.

Is there a way to call a row by the rows number?? And then how would I use the info in that specific row once it was requested??

Hope you understand this!!!

Regards, Paul

davidj
07-09-2008, 12:54 PM
OK your initial query will return a chunk of rows

if you take the first row from this result as 0 then use the LIMIT function in your SQL

it carries 2 params with the first being the offset and the second being how many rows to display after the offset

So LIMIT 3,1 will return the 4th row (i think its the 4th with the first being 0) and display just 1 row thereafter

tux
07-09-2008, 01:57 PM
Cheers Dj, I'll give that some thought and try it out tonight and let you know how I get on.

We will still have to continue our chat about the 1 to 1 tuts at some stage.

Thanks again mate,

Regards, Paul