I would like to have an after add event which redirects the user to another tables add page with a masterkey value. How can I get the id field of the record I just added? I have been unsuccessful with the code below but it should give a good idea of what I am trying to do.
Thanks
function AfterAdd()
{
//********** Check if specific record exists ************
global $conn;
$strSQLExists = "SELECT LAST_INSERT_ID()";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
// if record exists do something
header("Location: Sales_job_add.php?mastertable=Sales_customer&masterkey1=".$data[0]);
exit();
}
else
{
// if dont exist do something else
}
}