I am selecting by id Dan Shirah <mrsquash2@xxxxxxxxx> wrote: Date: Thu, 5 Jul 2007 15:51:56 -0400 From: "Dan Shirah" <mrsquash2@xxxxxxxxx> To: "elk dolk" <elkdolk@xxxxxxxxx> CC: php-db@xxxxxxxxxxxxx Subject: Re: Re: record pointer Okay, in your first post you said you were selecting by category, now you're saying you are selecting by ID and want all corresponding records that have the same category as the selected ID. Which way are you trying to do this?? On 7/5/07, elk dolk wrote: > > 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)! > > > > Frank Flynn wrote: > This is standard SQL: > > SELECT id, name ,cat FROM catTable WHERE cat = 'zzz'; > > > This would return something like > ---------------------------- > id name cat > ---------------------------- > 1 fred zzz > 5 fefe zzz > 18 Mr. Puddles zzz > 27 Moris zzz > > > and so on > > > Your column 'id' is the pointer you're looking for. You should define it > as 'PRIMARY KEY' and perhaps AUTO_INCREMENT (this means MySQL will > automatically assign a value to it). > > > > > > > > > > Hi all, > > > My DB has the following columns: id, name ,cat. I want to select a cat > i.e. cat=zzz when the query is finished I should see a specific record > within this cat which is defined by id, like id=yyy > Any idea how to do this? Is there a function or something like record > pointer in MySQL ? > > > cheers > > > > > > > --------------------------------- > Get your own web address. > Have a HUGE year through Yahoo! Small Business. --------------------------------- Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us.