The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Getting the id of a result before it's posted?
I have a tutorial system set up. I have just added a feature that allows images for the tutorial to be uploaded to data base. It saves them with the tutorial id so it can repeat the image code for the tutorials using a where cause with tutorial ids. But I can't do this if the tutorial id is not posted yet. Is it possible to get the id before it's posted is my basic question.
:banana: |
#2
|
|||
|
|||
Lock the table, find out the first available ID, insert all your stuff related to the ID, and then unlock the table. The locking is to avoid concurrent modifications and hence duplicate IDs. You won't encounter the problem unless you are making a lot of queries each second.
|
#3
|
|||
|
|||
I suggest doing this the way vBulletin handles newpost attachments: each new post has a posthash, which serves as the temporary ID.
|
#4
|
|||
|
|||
Quote:
|
#5
|
|||
|
|||
Yes. You generate a hash when you first access the new post page, then you pass the hash on via $_POST data. When you insert data into other tables, insert it without specifying id, but with specifying the hash. Then, when you actually save the whole post, update the entries by removing the hash and inserting the real id.
|
#6
|
|||
|
|||
Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|