I am inserting data into a db with an id number that is auto incremented. What is the best way to get the id number that MySQL gives that record?
This is what I'm doing now:
mysql_query("INSERT INTO charts (id, userID, month, year) VALUES ('', 2313, 10, 2003)");
then
$result = mysql_query("SELECT id FROM charts WHERE userID=2313 AND month=10 AND year=2003");
Is there an easier way to do this? All in one query would be nice. I'm not that great with MySQL so thanks for the help!