![]() |
i want to call in settinggroup the last settinggroupid (for example, 32 that i just created in settinggroup with a NULL). here what i came up with:
PHP Code:
the script returns this: --------------------------------------- INSERT INTO setting VALUES (NULL,Resource id #6,'News forum ID','newsforumid','15','The specified forum will contain threads viewed on the main page only.','',0) instead of: --------------------------------------- INSERT INTO setting VALUES (NULL,32,'News forum ID','newsforumid','15','The specified forum will contain threads viewed on the main page only.','',0) |
PHP Code:
|
Just use $DB_site->last_insert().
|
is not working PPN.. it returns Array instead of the value.
FireFly, can you post the exact line please? i need to make a query on this. here it is what i try to do: PHP Code:
|
Yes it returns an array, thats how you get data from the database, or you fetch row or fetch object.
use $settinggroupid[LAST_INSERT_ID()] as you said its an array. If your ever curious to what value an array holds you can use print_r($array); and it will print out all the values of $array. Anyway you can use $DB_site->insert_id(); to use the abstraction layer if you want. its part of the abstraction layer which simply uses mysql_insert_id(); which is a nice trait of mysql as it gets the last value of the auto incrememnt column. |
Quote:
PHP Code:
btw scott, ty for your tips. i learn alot from mysql.com site, but you guys have all kind of tricks.. ;) |
The bit of code you posted is correct nakkid.
mysql_insert_id() returns the last auto-increment ID that was insert into the DATABASE during the current connection. |
use this
PHP Code:
|
thanks alot PPN... i posted a thread in Website Feedback. let me know if i'm crazy.. read more in my signature why i decide not to post any hacks anymore here.
however, i will give you a copy of the script once completed, so you can use it. i will keep in touch here through pm's and email. thanks alot for all your support (scott and chen). |
All times are GMT. The time now is 04:43 PM. |
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:
|