I am using xPDOObject to create a new record in a custom table (as per Bob's Guides).
The problem I have is I want to store the ID of the created record, so that I can use it when creating related records in another table.
I tried adding
$_SESSION["lastID"] = mysql_insert_id();
but the session variable is created but empty
I added it here in the snippet:
/* Save data from form and throw out errors if fails */
if (!$contact->save()) {
$errorMsg='Failed to save message';
$hook->addError('error_message',$errorMsg);
return false;
}
else
$_SESSION["lastID"] = mysql_insert_id();
return true;
Is there a way to do this?