Does anyone know if the JSTL database tags (<sql>) provide any method for
retrieving the unique ID of the row that was inserted last (when you set
up you mySQL database table to AUTO_INCREMENT the unique id).

This is how I do it using PHP, which provides the mysql_insert_id()
function for just this purpose:

  $query = "INSERT INTO foo (name, phone) VALUES ('Jane Doe','555-1212')";
  $LINK = mysql_pconnect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD);
  $result = mysql_db_query ("$DB", $query);
  $my_id = mysql_insert_id($LINK);

Thanks!

-carole
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Carole E. Mah                     [EMAIL PROTECTED]
           Senior Programmer/Analyst
   Brown University Scholarly Technology Group
               phn 401-863-2669
               fax 401-863-9313
            http://www.stg.brown.edu/
  personal: http://www.stg.brown.edu/~carolem/


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to