1<?php
2// use mysql_insert_id():
3$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
4if (!$link) { die('Impossible de se connecter : ' . mysql_error()); }
5mysql_select_db('mydb');
6mysql_query("INSERT INTO mytable (product) values ('something')");
7printf("last inserted id is %d\n", mysql_insert_id());
8?>