MySQL error log
#1

Well so I'm just a rookie at MySQL I basicially know the storing, inserting and selecting things out from MySQL but I have no idea what's wrong with this code lol.

[18:46:45 05/25/17] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('3') (Query: "SELECT * FROM `gpci` WHERE `gpci` = '(CENSORED)'")
[18:46:45 05/25/17] [WARNING] CMySQLHandle:eleteSavedResult - invalid result id ('0')

Script:
Code:
COMMAND:match(playerid, params[])
{
    if(!PlayerInfo[playerid][power]) return SendClientError(playerid, CANT_USE_CMD);
    new emri;
    if(sscanf(params, "u", emri)) return SCP(playerid, "<partofname/playerid>");
	new sql[164], gpcija[64], Cache:result;
	gpci(emri, gpcija, sizeof(gpcija));
	mysql_format(sqldb, sql, sizeof sql, "SELECT * FROM `gpci` WHERE `gpci` = '%s'", gpcija);
	mysql_query(sqldb, sql);
	if(cache_num_rows())
	{
	    new rows = cache_num_rows();
	    for(new i; i<=rows; i++)
	    {
		    new emri1[128];
			cache_get_field_content(i, "name", emri1);
			if(strcmp(emri1, PlayerName(emri)) && strcmp(emri1, "NULL"))
			{
				format(iStr, sizeof(iStr), "{ff0000}[AC]: %s matches with %s", emri1, PlayerName(emri));
				SendClientMessage(playerid, -1, iStr);
			}
		}
	}
	else
	{
	    SendClientMessage(playerid, -1, "{ff0000}Can't find any!");
	}
	cache_delete(result);
	return 1;
}
Reply
#2

Hello?
Reply
#3

Managed to fix it by this, forgot to add the following Cache to the query string.

result = mysql_query(sqldb, sql);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)