Posts: 1,648
Threads: 482
Joined: Jun 2010
pawn Код:
C:\Users\berni\Desktop\Bone County Roleplay\gamemodes\rp.pwn(2386) : error 033: array must be indexed (variable "result")
pawn Код:
MySQL_GetString(sqlid, fieldname[], tablename[])
{
new query[256], result[256];
format(query, sizeof(query), "SELECT %s FROM %s WHERE id = %d LIMIT 1", fieldname, tablename, sqlid);
mysql_query(query);
mysql_store_result();
result = mysql_fetch_row(result); // Line with error.
mysql_free_result();
return result;
}
Posts: 2,082
Threads: 118
Joined: Jan 2010
Reputation:
0
I believe you don't need to assign what mysql_fetch_row() returns. You can just do "mysql_fetch_row(result)", as "result" is passed by reference.
Posts: 1,648
Threads: 482
Joined: Jun 2010
Thanks, but everytime I try and assign a variable to it, it says:
pawn Код:
C:\Users\berni\Desktop\Bone County Roleplay\gamemodes\rp.pwn(445) : error 047: array sizes do not match, or destination
Variable:
pawn Код:
new result[100];
result = MySQL_GetString(PlayerSQLID[playerid], "PlayerName", "Accounts");
SendClientMessage(playerid, COLOUR_GREY, result);
Doesnt work.
Posts: 7,801
Threads: 187
Joined: Feb 2010
Reputation:
0
What MySQL plugin are you using?
Posts: 1,648
Threads: 482
Joined: Jun 2010
Posts: 1,648
Threads: 482
Joined: Jun 2010
I have tried it, but it doesnt return correctly.
Posts: 1,648
Threads: 482
Joined: Jun 2010
It doesnt return anything, i've printf'd it several times.