flowingwindrider Posted July 26, 2007 Share Posted July 26, 2007 I'm having trouble learning to use foreign keys. Does anyone know of a good tutorial they could point me to? Link to comment https://forums.phpfreaks.com/topic/61889-foreign-keys/ Share on other sites More sharing options...
effigy Posted July 26, 2007 Share Posted July 26, 2007 What kind of trouble? A foreign key is a key that points to another table. I found this from a Google search. Link to comment https://forums.phpfreaks.com/topic/61889-foreign-keys/#findComment-308123 Share on other sites More sharing options...
flowingwindrider Posted July 26, 2007 Author Share Posted July 26, 2007 I have a series of tables in a database, each one pertaining to a classified ad category. I need another table that groups all of their id's together in one place. Do I set the foreign keys in the new table to reference the others, or do I set the fk's in each table to reference the new one? Link to comment https://forums.phpfreaks.com/topic/61889-foreign-keys/#findComment-308126 Share on other sites More sharing options...
effigy Posted July 26, 2007 Share Posted July 26, 2007 Like this? Ad Categories =================================================== id | name 1 | Auto 2 | Home 3 | Pets Ads =================================================== id | cat_id | desc 1 | 3 | 2 yr. old hound. 2 | 1 | 1990 VW Bug. 3 | 2 | 4 bedroom somethingorother. In this case cat_id is the foreign key, which references Ad Categories' id. Link to comment https://forums.phpfreaks.com/topic/61889-foreign-keys/#findComment-308183 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.