For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > July 2007 > Re: [PHP-DB] Re: record pointer









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Re: record pointer
Niel Archer

2007-07-05, 6:58 pm

Hi

> O.K. the id column is primary key and it is auto_incerment .I think my explanation was not clear enough :
>
> this is my query : SELECT * FROM table WHERE ID=$ID
> this will find the record with the specified ID and I will be able to see it, now I want to be able to scroll up and down to all the records that belong to the same cat(egory)!


Assuming that is correct now, use a sub-query:

SELECT id, name FROM table
WHERE cat = (SELECT CAT FROM table WHERE id=$ID);

Niel
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com