dbTalk Databases Forums  

Determining primary field

mailing.database.myodbc mailing.database.myodbc


Discuss Determining primary field in the mailing.database.myodbc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Resolution
 
Posts: n/a

Default Determining primary field - 07-06-2003 , 04:42 PM






------=_NextPart_000_001A_01C343E5.0ABF8040
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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.=20

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.

------=_NextPart_000_001A_01C343E5.0ABF8040--


Reply With Quote
  #2  
Old   
 
Posts: n/a

Default Re: Determining primary field - 07-06-2003 , 04:55 PM






you mean the primary key (also called primary index), do you?

just query 'SHOW INDEX FROM yourtable' and read all rows with Key_name =
=3D '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...

=B7=B7=B7 yves at unclassified.de

=20
-----Urspr=FCngliche Nachricht-----=20
Von: "Resolution" <Resolution (AT) columbus (DOT) rr.com>
An: <mysql (AT) lists (DOT) mysql.com>
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.=20

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/mysql?unsub=3...ie.nctu.edu.tw


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.