sqlite count()
#1

Hi, I'm creating a namechange dialog and I don't want the player to be able to change his name if it's used already, but it's not working for some reason. This is the part which is not working:
Код:
new query[100], DBResult:result;
					
format(query, sizeof(query), "SELECT COUNT(*) FROM accounts WHERE Name = 'q' COLLATE NOCASE", inputtext);
result = db_query(database, query);
					
if (db_get_field_int(result, 0)) ShowPlayerDialog(playerid, DIALOG_CHANGE_NAME, DIALOG_STYLE_INPUT, "Change Name", "That name is already in use by someone else.\nPlease type your new desired name below:", "Change", "Cancel");
so basically it returns 0 rows while there is actually a row with the name I'm trying to set for myself. What's the problem?

EDIT: lol i'm stupid it has to be %q
Reply
#2

sorry, didn't saw the edit
Reply
#3

Not sure if it works but did you try count(id)?

So if it finds any ID with the name that the player entered it means that the name is used
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)