Quote:
Originally Posted by Konstantinos
You have used "field_assoc", that means that the second parameter is the name of the field but you can retrieve the last inserted ID using the field functions. The second parameter is 0 (for fieldid) but since there are no more selected, it's 0 by default:
pawn Код:
User[playerid][P_ID] = db_get_field_int(Result);
---
pawn Код:
User[playerid][P_ID] = db_get_field_assoc_int(Result, "userid", P_ID, sizeof P_ID); //2 Errors on Line 163 User[playerid][P_RANK] = db_get_field_assoc_int(Result, "admin", P_RANK, sizeof P_RANK); //2 Errors on Line 164
P_ID and P_RANK are constants used in the enumerator and actually there's no reason to try get the size (which you would have to manually specify it) as they're not strings. That would be:
pawn Код:
User[playerid][P_ID] = db_get_field_assoc_int(Result, "userid"); User[playerid][P_RANK] = db_get_field_assoc_int(Result, "admin");
It's correct and it is used to avoid calling strlen twice.
|
Thank you sir. Fixed my errors! Much appreciated!