MySQL "insert into two tables"
Hi...
Iam creating a database for the music club I belong to. "PHP +MYSQL" Ive studied databases but I have problems with the implementation.
I have two tables one called users with a uid as a primary key. And another table called schedule with sched_id as the primary key.
The registration input form contains a a schedule through which the user can choose his schedule...and he has to enter email address etc..
Then I do the following:
$sql= "INSERT INTO users(name,major,phone,email,address,instrument) ".
"VALUES('$name','$major','$phone','$email','$address','$instrument')";
@mysql_query($sql) or die(mysql_error());
The question is : Now that Ive entered the data for the user how do I insert his schedule in a manner that links them together. Ive added "uid" the primary key of the user table to the schedule table.
|