Biggest fail to a GetPlayerName function!
#1

Ahaha, I tried, but I have no clue how to do this...

pawn Код:
stock GetPlayerNameFromSQLid(SQLid)
{
    new query[256], pname[24];
    format(query, 256, "SELECT `username` FROM `accounts` WHERE `SQLid` = '%d'", SQLid);
    mysql_query(query);
    mysql_store_result(pname);
    return pname;
}
Reply
#2

pawn Код:
stock GetPlayerNameFromSQLid(SQLid)
{
    new query[53], pname[24]; // You don't need 256 cells...
    format(query, sizeof(query), "SELECT `username` FROM `accounts` WHERE `SQLid` = '%d'", SQLid);
    mysql_query(query);
    mysql_store_result();
    mysql_fetch_field("username", pname);
    mysql_free_result();
    return pname;
}
Something similar, I've never really needed to retrieve only 1 value from a MySQL query in PAWN, so I use an asterisk.
Reply
#3

Thanks.

is the [number] showing the length of the string by amount of characters?
Reply
#4

Quote:
Originally Posted by ♂ Antonio [G-RP
]
Thanks.

is the [number] showing the length of the string by amount of characters?
Figure it out yourself.
Reply
#5

Okay

Edit: Sorry for what I said, I'm REALLY confused right now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)