![]() |
vB Save() mysql_insert_id ?
Hey,
I am trying to alter my newly upgraded vBulletin Forum register.php file. All i want to do is insert the userid from that registered person and insert it into another table. In vB2 this was very easy. I am unsure how to do this in vB3 though. I have looked at vBulletin Data Documentation but didnt see anything relevant to this issue. Can anyone help me? Thanks in Advance. James |
Don't edit the register.php file. Use a plugin on the register_addmember_complete hook, where $vbulletin->userinfo['userid'] will be the new userid.
-- hugh |
or use a trigger.
|
Quote:
P.S. the id value is normally returned when the save() function is execute so... PHP Code:
|
Quote:
PHP Code:
|
Sorry, have you got a link for more info on these hooks you are referring to?
EDIT - I have found the hook you are referring to. I will test my code and see if it works. Thanks. --------------- Added [DATE]1203427548[/DATE] at [TIME]1203427548[/TIME] --------------- Thanks that worked great! :) James |
Quote:
http://dev.mysql.com/doc/refman/5.0/en/triggers.html The advantage of this approach is that you don't have to write any PHP code, it just happens automagically within MySQL. The disadvantage is that ... well, you don't have any PHP code and it happens automagically within MySQL. So you can't add any data which can't be derived from a select on existing MySQL data, and you can't handle errors gracefully. And of course it's MySQL version specific. If all you are doing is literally inserting data already present in your table(s) into another table, triggers are a useful shortcut. -- hugh |
wow thats f***in sweet! Thx for pointing that out, too bad the company i work at still uses PHP 4 ><.
|
MySQL... not PHP. ;)
|
Still, most servers have MySQL 4.x installed :p.
|
All times are GMT. The time now is 09:56 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|