Return to Snippet

Revision: 888
at August 19, 2006 06:19 by arcturus


Updated Code
//Bloqueamos la tabla
mysql_query("LOCK TABLES myTable WRITE");
//Hacemos el insert
mysql_query("INSERT INTO myTable ......");
//Obtenemos el id del proyecto
$result_id=mysql_query("SELECT LAST_INSERT_ID()");
define('MY_ID',mysql_fetch_row($result_id));
//Desbloqueamos
mysql_query("UNLOCK TABLES");

Revision: 887
at August 19, 2006 06:07 by arcturus


Initial Code
//Bloqueamos la tabla
mysql_query("LOCK TABLES myTable WRITE");
//Hacemos el insert
mysql_query("INSERT INTO myTable ......");
//Obtenemos el id del proyecto
define('MY_ID',mysql_query("SELECT LAST_INSERT_ID()"));
//Desbloqueamos
mysql_query("UNLOCK TABLES");

Initial URL


Initial Description
Select the last autoincrement index from the last inserted item in a table.

Initial Title
Select index from last inserted item.

Initial Tags
mysql, php

Initial Language
PHP