RE: [PHP] Distinguishing foreign keys in a table?
| From: | Ken Tozier | Date: | Mon, 21 Apr 2003 01:47:52 +0000 |
| Subject: | RE: [PHP] Distinguishing foreign keys in a table? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-144585@lists.php.net to get a copy of this message | ||
On Sunday, April 20, 2003, at 09:16 PM, Mark Charette wrote:
After reading these links, they seem to imply that there is no built in information a generic PHP routine can extract from a table field to determine if that field is a foreign key or not. It is the programmer's responsibility to know which fields link to which tables and to write custom code for each table type that contains foreign keys. Is that the correct interpretation? Thanks KenFrom: Ken Tozier [mailto:kentozier@attbi.com] Is it possible to determine if a field in a table is a foreign key? I looked at all the mysql_xxx functions but didn't see anything that looked like it would return this type of info. Once a foreign key is established, I would also need to get the table name associate with that key so I could navigate the link. Is that possible?See http://www.mysql.com/doc/en/ANSI_diff_Foreign_Keys.html and http://www.mysql.com/doc/en/example-Foreign_keys.html to learn how MySQL current handles (and doesn't handle) foreign key constraints.