PDA

View Full Version : mysql_insert_id()


wolfe
06-21-2013, 02:05 PM
whats the vbulletin alternative for mysql_insert_id();

thanks

kh99
06-21-2013, 02:30 PM
$vbulletin->db->insert_id()

wolfe
06-21-2013, 04:21 PM
thanks your a star.

Christos Teriakis
06-21-2013, 05:51 PM
In case that you want to store in a variable the id of the new added record use:

$variable = $vbulletin->db->insert_id();
If you haven't any Primary field (auto increment) you must use:

$variable = $vbulletin->db->insert_id(field_name_here);


I've found this article very useful for vB coding:
https://vborg.vbsupport.ru/showthread.php?t=98047&highlight=variables

Scanu
06-21-2013, 09:50 PM
thanks your a star.
You're :D