xoops forums

tvn3015

Just popping in
Posted on: 2009/3/19 21:42
tvn3015
tvn3015 (Show more)
Just popping in
Posts: 53
Since: 2007/4/18
#1

Automatically create the next sequence ID Help?

I am trying to get a new sequence ID generated and I believed the following code will do it but somehow the $newid always = 0 (I thin it should be 8 because in the table "DanhGia_Phebinh" I have 7 rows already.
$newid = $xoopsDB->genId($xoopsDB->prefix("DanhGia_Phebinh")."_phebinhid_seq");

Any help would be appreciated!

TVN
http://www.XoopsViet.com - Xoops for Vietnamese

ghia

Community Support Member
Posted on: 2009/3/19 21:57
ghia
ghia (Show more)
Community Support Member
Posts: 4954
Since: 2008/7/3 1
#2

Re: Automatically create the next sequence ID Help?

It is a function for having compatibility with older versions. It will always return zero.
If you want an automatic ID, use an auto-increment field in your database.

tvn3015

Just popping in
Posted on: 2009/3/19 23:19
tvn3015
tvn3015 (Show more)
Just popping in
Posts: 53
Since: 2007/4/18
#3

Re: Automatically create the next sequence ID Help?

Thank you ghia for your reply, I got it working now.
http://www.XoopsViet.com - Xoops for Vietnamese