28.09.2016, 06:53
I'm learning the functions of SQLite and was wondering if there's a function that works the same as cache_insert_id. If not, how would I script the same kind of function for SQLite?
new
query[128 * 3]
;
format(query, sizeof(query),
"INSERT INTO `users` (`username`, `IP`, `joindate`, `password`) VALUES ('%s', '%s', '%s', '%s')",\
DB_Escape(pName(playerid)),
DB_Escape(User[playerid][accountIP]),
DB_Escape(User[playerid][accountDate]),
DB_Escape(password),
User[playerid][accountScore],
User[playerid][accountCash],
DB_Escape(User[playerid][accountQuestion]),
DB_Escape(User[playerid][accountAnswer])
);
db_query(Database, query);
new DBResult: result;
result = db_query(Database, "SELECT last_insert_rowid()");
User[playerid][accountID] = db_get_field_int(result);
db_free_result(result);
Is this what you are looking for?
A snippet that I copied from JakAdmin 3.4.1 PHP Code:
|