$sql1 = "insert into firsttable (firstname, lastname)
values('Jack','Chan')";
$resultsql1 = mysql_query($sql1);

Add ... or die(mysql_error()) to the end of that line.

$sqlLastID = "select LAST_INSERT_ID() from firsttable";
$resultlast = mysql_query($sqlLastID);

Add the same thing here.

$FirstLast = mysql_result($resultlast,0,0);

$sql2 = "insert into secondtable (FirsttableID,secfirstname, seclastname)
values('$FirstLast','Jacky','Chany')";
$resultsql2 = mysql_query($sql2);

And here as well.

$sqlLastIDsec = "select LAST_INSERT_ID() from secondtable";
$resultlast2 = mysql_query($sqlLastIDsec);

And here.

$secondLast = mysql_result($resultlast2,0,0);

$sql3 = "insert into Thirdtable (SecondTableID,FirsttableID,Thirdfirstname,
Thirdlastname) values('$secondLast','$FirstLast','Steve','Chan')";
$resultsql3 = mysql_query($sql3);

Everywhere you have mysql_query()

$sqlLastIDthird = "select LAST_INSERT_ID() from Thirdtable";
$resultlast3 = mysql_query($sqlLastIDthird);
$ThirdLast = mysql_result($resultlast3,0,0);


--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to