Quick Question/Error. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Quick Question/Error. (
/showthread.php?tid=301243)
Quick Question/Error. -
Dokins - 03.12.2011
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;
}
Re: Quick Question/Error. -
Ash. - 03.12.2011
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.
Re: Quick Question/Error. -
Dokins - 03.12.2011
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.
Re: Quick Question/Error. -
Scenario - 03.12.2011
What MySQL plugin are you using?
Re: Quick Question/Error. -
Dokins - 03.12.2011
R5. @RealCop.
Re: Quick Question/Error. -
Scenario - 03.12.2011
You may want to try this:
https://sampwiki.blast.hk/wiki/MySQL#mysql_fetch_field_row
Re: Quick Question/Error. -
Dokins - 03.12.2011
I have tried it, but it doesnt return correctly.
Re: Quick Question/Error. -
Scenario - 03.12.2011
What's it return?
Re: Quick Question/Error. -
Dokins - 03.12.2011
It doesnt return anything, i've printf'd it several times.
Re: Quick Question/Error. -
Scenario - 03.12.2011
Did you do this?
pawn Код:
mysql_fetch_field_row(result, fieldname);