you mean the primary key (also called primary index), do you?
just query 'SHOW INDEX FROM yourtable' and read all rows with Key_name = 'PRIMARY'.
you can play around with this in the mysql commandline. you'll get all column names
that belong to the primary key in the Column_name field of the returned recordset.
at least, that's how it is in mysql 3.23.56-nt...
··· yves at unclassified.de
-Ursprüngliche Nachricht-
Von: Resolution [EMAIL PROTECTED]
An: [EMAIL PROTECTED]
Gesendet: Sonntag, 6. Juli 2003 23:35
Betreff: Determining primary field
Hello,
I apologize if this is a very simple question but I have spent the last half hour
searching for an answer to it and have thus far been unable to find one. I am pretty
new to mysql so please be easy on me if this is painfully obvious :)
I am trying to determine the primary field in a table through a query from php to my
database. I have several tables that could be potentially queried by a particular
function in my web site, but the primary field used to identify the ID for different
item types are all named specifically to match the table and item type that it is
stored in it.
My solution to this was to use the primary key in each table as the identifying factor
to compare the item ID with the correct field data. I have not been able to find any
information on how to obtain the primary field so as to compare its value for each row
to the item ID that I want to match.
Thank you in advance for any assistance or direction that you could point me in.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]