//conexion $bus=mysql_query("SELECT id FROM tabla ORDER BY id desc LIMIT 0,1"); $con=mysql_fetch_array($bus); $laId=$con['id']+1;