The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
process for creating a new id for a new product "post"
It's been a long time since I did some serious php and database work so bear with me
I have a product I'm working on that consists of a thread/post architecture. What I'm working on now is trying to figure out how to create a new ID for when inserting new records in the DB. Normally, I would think that I would just do a count on the records of that table and add 1 to create a new unique ID, but going through some other products people have created I see things like "$cleanfileid = $vbulletin->input->clean_gpc('r', 'id', TYPE_UINT);" being used a lot so I was curious if vBulletin already has a prebuilt function to generate new IDs. |
#2
|
|||
|
|||
I think the way it works in vb is that there's a database column defined as auto_increment so whenever you add a record, that field is automatically set to the next value. Then if you need the new id in your code you can call $db->insert_id() to get the value from the last insert.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|