Mysql - 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)
+--- Thread: Mysql (
/showthread.php?tid=505796)
Mysql -
rutger188 - 10.04.2014
hello how do I put this mysql r5 to r7
I just need help do not get out: (
I see once how this piece I need to rest myself
mysql_query to mysql_function_query
Код:
format(string, sizeof(string), "SELECT * FROM server WHERE Server = '1'");
mysql_query(string);//Queries
mysql_store_result(); //Stores the result
if(mysql_num_rows() > 0)
{
new wdata[128];
while(mysql_retrieve_row())
{
mysql_get_field("Gamemode",wdata);
CURRENT_GAMEMODE = strval(wdata);
}
Re: Mysql -
Konstantinos - 10.04.2014
https://sampforum.blast.hk/showthread.php?tid=337810
Assuming there's only 1 rows, otherwise your code above would fail because CURRENT_GAMEMODE would hold only the value of the last row:
pawn Код:
// connection handle is the variable you've stored the connection ID:
// MySQL = mysql_connect(...);
mysql_function_query(/* Connection Handle HERE*/, "SELECT * FROM server WHERE Server = 1", true, "OnServerLoad", "");
forward OnServerLoad();
public OnServerLoad()
{
new rows;
cache_get_data(rows, _);
if (rows)
{
new wdata[128];
cache_get_field_content(0, "Gamemode", wdata);
CURRENT_GAMEMODE = strval(wdata);
}
}