Help with ID Accounts

Started by KrlozZ..., May 02, 2018, 08:33 AM

Previous topic - Next topic

KrlozZ...

Hello, well i use IDS for my accounts and its a problem since account 999, my function to add a new id is;
local o = QuerySQL( db, "SELECT MAX(ID) FROM Accounts" );
local asd = GetSQLColumnData( o, 0 )+1;

let me explain, when you register, it check the last ID and add the new account with another ID +1, but since account ID 999, it made 9991 account instead of 1000, do you have another way to do it, or to fix it ?

Xmair

Use
GetSQLColumnData( o, 0 ).tointeger() + 1;GetSQLColumnData returns a string afaik.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

KrlozZ...

Quote from: Xmair on May 02, 2018, 10:08 AMUse
GetSQLColumnData( o, 0 ).tointeger() + 1;GetSQLColumnData returns a string afaik.

oh nice it works, but it taking always the max as 999, not taking the real max which is 1477, so how to take correctly the max ID ?,

Saiyan Attack

hmm, what type you prefer in db "NUMERIC" and "INTEGER" for ID column? If you are using these one. Then try to use "INTEGER PRIMARY KEY" this will automatically generates total number of your account. i mean to say, it works exactly you want. there is no need to add extra things. just skip this line while inserting account info ...