SA-MP Forums Archive
How to return mysql result? - 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: How to return mysql result? (/showthread.php?tid=270660)



How to return mysql result? - ajwar - 21.07.2011

Hi, i wan't to get playerbusiness id and then use it. I tryed so:

pawn Код:
public GetPlayerBusiness(playerid, businessid)
{
        if (businessid == INVALID_BUSINESS_ID) return false;
        new query[128];
        format(query,128,"SELECT `id` FROM `"#MYSQL_BUSINESS_TABLE_NAME"` WHERE owner = '%s'",PlayerName(playerid));
        mysql_query(query);
        mysql_store_result();

}



Re: How to return mysql result? - Patrik356b - 21.07.2011

You may want to look at the mysql tutorials..


Re: How to return mysql result? - iJumbo - 21.07.2011

mysql_query("SELECT myid FROM players LIMIT 1");
mysql_store_result();

new myid = mysql_fetch_int();

mysql_free_result();


https://sampwiki.blast.hk/wiki/MySQL#mysql_fetch_int