Quick Question/Error.
#1

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;
}
Reply
#2

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.
Reply
#3

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.
Reply
#4

What MySQL plugin are you using?
Reply
#5

R5. @RealCop.
Reply
#6

You may want to try this: https://sampwiki.blast.hk/wiki/MySQL#mysql_fetch_field_row
Reply
#7

I have tried it, but it doesnt return correctly.
Reply
#8

What's it return?
Reply
#9

It doesnt return anything, i've printf'd it several times.
Reply
#10

Did you do this?

pawn Код:
mysql_fetch_field_row(result, fieldname);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)