Need help interpreting a mySQL function please
I have found this tres cool mySQL function to do exactly what I want, but the examples don't show me clearly how to use it in php. I am inserting an event record and need to add the categories associated with that event to another table at the same time, so I need the event_id (auto-incremented) to add to the 2nd table. So this is what I came up with:
First I insert the event record and then...
Code:
query = "SELECT LAST_INSERT_ID() FROM event ";
$result = @mysql_query($query,$connection) or die("Couldn't execute $query query. <br> mysql error: ".mysql_error());
$row = mysql_fetch_array($result);
$neweventid = $row['event_id'];
Is there a more elegant way to accomplish this? (not even sure if this would work). Thanks. e :)