mySQL command isn't working.
#1

Code:
CMD:loopserial(playerid, params[])
{
	if(!PlayerInfo[playerid][pAdmin]) return SCM(playerid, RED, "Not authorized");
	new query[128], serial[40];
	if(sscanf(params, "s[45]", serial)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /loopserial [Serial IDl]");
	mysql_format(sqlL, query, sizeof(query), "SELECT Name, LastLogged FROM players WHERE Serial = '%e'", serial);
	mysql_pquery(sqlL, query, "GetListSerial", "i", playerid);
	return 1;
}
Code:
forward GetListSerial(playerid);
public GetListSerial(playerid)
{
	if(!PlayerInfo[playerid][pAdmin]) return 1;
	if(cache_num_rows() == 0) return SendClientMessage(playerid, COLOR_WHITE, "I couldn't find any account with the matching SERIAL ID.");
	new serial[10000], lastlog[64], name[MAX_PLAYER_NAME];
	for(new i = 0; i < cache_num_rows(); i++)
	{
		cache_get_field_content(i, "Name", name);
		cache_get_field_content(i, "LastLogin", lastlog);
		format(serial, sizeof(serial), "%s{FFFF00}%s  (%s)\t\t{FFFFFF}\n", serial, name, lastlog);
	}
	ShowPlayerDialog(playerid, NOTEXISTING, DIALOG_STYLE_TABLIST, "Serials IDS", serial, "Okay", "");
	return 1;
}
When I write in game /loopserial [serial which actually exists] it does not work, it says "I couldn't find any account with the matching SERIAL ID".
Help plss
Reply
#2

What's your correct row name? LastLogged or LastLogin?
Code:
mysql_format(sqlL, query, sizeof(query), "SELECT Name, LastLogged FROM players WHERE Serial = '%e'", serial);
Code:
cache_get_field_content(i, "LastLogin", lastlog);
They appear to be different from each other
Reply
#3

Code:
new query[128], serial[41];
40-characters long + \0
Reply
#4

Quote:
Originally Posted by zerruv
View Post
What's your correct row name? LastLogged or LastLogin?
Code:
mysql_format(sqlL, query, sizeof(query), "SELECT Name, LastLogged FROM players WHERE Serial = '%e'", serial);
Code:
cache_get_field_content(i, "LastLogin", lastlog);
They appear to be different from each other
I changed LastLogin to LastLogged, still the same. My correct is LastLogged
Reply
#5

bumb
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)