Re: automatic call reference creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



not sure what u want here but
have you looked at the identiry field ??
its called auto_increment in mysql and this gives it record in a database a unique number


eg
"Insert into table (date_call)values(now() )"

then after the insert do
"select last_insert_id()"

pedro

Gawie Marais wrote:
hi all,

i need to create an automatic call reference. i though it would work using
the date as ccyymmdd and by adding a '001', '002', etc to the end.

now, i know how to format the date but how would i increment the 001, 002 at
the end... ? i understand that i would have to check back to the database to
check the last one used. but how... ?

alternatively is to just generate a random number, check it against the
database to see if it's not already used. if not use it. if its used
already, just create another one... ?

OR

do you guys have any laternative suggestions ?


Regards,


Gawie.

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux