MySQL | Does not return the correct value
#1

hello !

whay this not return the correct value from table ?

here the stock:

pawn Код:
stock GetPlayerClan(playerid)
{
    new query[100];
    format(query,sizeof(query),"SELECT `Clan` FROM `Users` WHERE `Nick`='%s'",GetName(playerid));
    mysql_query(query);
    mysql_store_result();
    if(mysql_retrieve_row() == 1) mysql_fetch_field_row(query, "Clan");
    mysql_free_result();
    return strval(query);
}
thank's.
and anyone, i want guide from mysql. but only about function's/
thank for the helpers.
Reply
#2

I think problem because you returning value when result it's empty

You using mysql_free_result and then returning query.
Reply
#3

What kind of value is 'Clan'? Integer? String? If it's an integer, then just use:

pawn Код:
new theClan = mysql_fetch_int();
mysql_free_result();
return theClan;
You should consider reading http://dev.mysql.com
Reply
#4

If it's an string, then return query;
Reply
#5

this int.
i'm try Vince device.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)