CodeIgniter Forums
ID incrementing for multiple users - please help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: ID incrementing for multiple users - please help (/showthread.php?tid=4610)

Pages: 1 2


ID incrementing for multiple users - please help - El Forum - 12-09-2007

[eluser]Wuushu[/eluser]
Table
T_INVOICE

fields
F_ID F_INVOICE_ID F_USER_ID F_OTHER_INFO
5 1003 12 .
4 1001 9 .......
3 1001 38 ...
2 1000 9 ....
1 1000 38 ....


Make in your model a function to see if a user has previous invoices, if not set insert-ID (F_INVOICE_ID) to 1000, if not, take value from last known invoice ID (F_INVOICE_ID), and increment it by 1.

Did i misunderstand your question/problem? If so forgive me.

Kind regards,
Christian S

Edit: Forum form ate my spaces