MySQL Forums
Forum List  »  General

Select from where? (Primary keys?)
Posted by: Chris Edie
Date: February 09, 2005 01:25PM

Hey, trying to design a somewhat dynamic search program in PHP but am stuck on a dynamic SELECT string ... basically I want it to look like this

$query = "SELECT * FROM `$table_name` WHERE PRIMARY KEY = $index_value"

so no matter what table I am searching, when $index value has a proper value it in, it will pull up the record.
The problem is that 'PRIMARY KEY' doesn't seem to work, is there a way to make it work, or do I have to have the name of the column that is the primary key?
Any suggestions?
Thanks,
-Chris

Options: ReplyQuote


Subject
Written By
Posted
Select from where? (Primary keys?)
February 09, 2005 01:25PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.