MySQL | Does not return the correct value - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL | Does not return the correct value (
/showthread.php?tid=264919)
MySQL | Does not return the correct value -
EviLpRo - 28.06.2011
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.
Re: MySQL | Does not return the correct value -
Raimis_R - 28.06.2011
I think problem because you returning value when result it's empty
You using mysql_free_result and then returning query.
Re: MySQL | Does not return the correct value -
Vince - 28.06.2011
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
Re: MySQL | Does not return the correct value -
gimini - 28.06.2011
If it's an string, then
return query;
Re: MySQL | Does not return the correct value -
EviLpRo - 28.06.2011
this int.
i'm try Vince device.