I have two tables in my database (department, employee)
-department table has three fields (seq, name, place).
-employee table has three fields too (seq, dept_seq, title).
-there are relation between two tables (seq is a primary key in "department" and foreign key in "Employee" as dept_seq).
- I want to insert in the two tables using this code:
$sql="insert into department select ifnull(max(seq),0)1,'".$_REQUEST['name']."','".$_REQUEST['place']."' from department";
mysql_query($sql) or die(mysql_error());
$sql2="insert into employee select
ifnull(max(seq),0)1,XXXXXXXXX,'".$_REQUEST['title']."' from employee";
now XXXXXXXXX is seq value that i wont take from department table but i dont now how i can insert this value into employee table
any suggestion???