Re: [phplib] auto-increment From: Víctor R. Ruiz (rvr <email protected>)
Date: 05/12/00

  Hola:

Joao Lima tecleó:
> The primary key of one of my tables is a whole number (auto-increment).
> Those somebody knows who can I access to the value that I must insert next.

  What I have done it's to define a new field called "md5" and store
  there a random and known value:

  $md5 = md5(random());

  $q->query("INSERT INTO TABLE (name, surname, md5) VALUES ('$name', '$surname', '$md5')");

  So I can check later the inserted register (well, we need now the
  the autoincremental field? ;)

  $q->query("SELECT id_table FROM TABLE WHERE md5 = '$md5'");

  
  Greetings,

-----------------------------------------
Víctor R. Ruiz rvr <email protected>
Subdirección de Comunicaciones
Universidad de Las Palmas de Gran Canaria
-----------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>