RE: [PHP-ES] ultimo registro insertado
| From: | Andrés Jaramillo | Date: | Mon, 03 Feb 2003 17:11:54 +0000 |
| Subject: | RE: [PHP-ES] ultimo registro insertado | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-31966@lists.php.net to get a copy of this message | ||
OK muchas gracias es lo que necesitaba...
$ultimo_id=mysql_insert_id();
despues de haber insertado el registro
salu2
----- Original Message -----
From: "Andrés Jaramillo" <anjarami@007mundo.com>
To: <lista@phpes.com>
Sent: Friday, January 31, 2003 11:29 PM
Subject: [PHP-ES] ultimo registro insertado
Tengo una duda.
Inserto un registro en una tabla mysql y quiero inmediatamente recuperar
ese registro por el ID, pero el ID se auto incrementa, de manera que no
puedo saber cual es, ahora lo estoy haciendo creando un numero aleatorio
e insertándolo con el registro y recuperándolo por ese numero, pero no
se si es la forma mas "elegante de hacerlo".
Gracias
---------------------------------------------------------------------
Archivo On-line: http://www.phpes.com/
via news: news://news.phpes.com/
Manual PHP en español: http://www.php.net/manual/es/
Para dar de baja la suscripción, mande un mensaje a:
lista-unsubscribe@phpes.com