Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/06/2010, 18:38
Avatar de Infernal
Infernal
 
Fecha de Ingreso: septiembre-2004
Ubicación: Tamaulipas, Mexico
Mensajes: 124
Antigüedad: 19 años, 6 meses
Puntos: 0
Respuesta: MYSQL: Obtener el id de un insert

Con SQL:
Código SQL:
Ver original
  1. SELECT (MAX(id)+1) AS id FROM tabla
  2. o
  3. SELECT (id+1) AS ID FROM tabla ORDER BY id DESC

Con PHP:
Código PHP:
Ver original
  1. mysql_query("INSERT INTO ...");
  2. $ultimo_id = mysql_insert_id() + 1;