Results 1 to 9 of 9
May 3, 2002, 06:26 #1
- Join Date
- May 2002
- 0 Post(s)
- 0 Thread(s)
Foreign Keys to AUTO receive referenced Primary Keys in MySQL.. Is it possible?
Hi there... I just registered here since I found all the answers from the users here to be quite helpful, this seems like a great place to get help (hard to find..)
I have a minor problem with MySQL: I want to be able to construct my database so that the Foreign Key automatically receive the Primary Key value when I add new data to my database. This is for different projects but I'll use my personal CD-database as an example...
Lets say I add a cd to the DB, it will get an ID(int) and according to what type of cd it is (game, movie, app, series) I want to add more information to the appropriate table (game, movie, app, series).
I can figure out how to do this with PHP variables but isn't there a way that I can build my DB in such a way that that won't be necessary? At school I use Sybase PowerBuilder which has this function in a nice GUI :P but they never tought us how to do this in script/sql..
So if someone could help me I'd be very greatful. (Also building a PHP/MySQL intranet site for a company now as a school project, and this would come in handy for that as well..)