Possible Duplicate:
PHP: how to get last inserted ID of a table?
I made a form and want to write data in two tables.
$sql = "INSERT INTO ma_forum (notcat_id, usr_id, not_titulo, not_status, not_tags, not_data, not_comentarios, not_resumo, not_texto)
VALUES('$categoria', '".$_SESSION[usr_name]."', '$titulo', '$status', '$tags', '".time()."', '$comentarios', '$resumo', '$texto')";
$res = mysql_query($sql) or die(mysql_error());
$sql_or = "INSERT INTO ma_forum_comentarios (comnot_habbo, comnot_data, comnot_status) VALUES('$_SESSION[usr_name]', '".time()."', '$status_comnot')";
$res = mysql_query($sql_or) or die(mysql_error());
But in the first table it writes the ID automatically auto_increment. But I would like to enter the ID of the first table and another column. Anyone know how to do?