SA-MP Forums Archive
Query doesn't seem to work - 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: Query doesn't seem to work (/showthread.php?tid=568565)



Query doesn't seem to work - Jimmy0wns - 23.03.2015

Tried loading the server MOTD and just can't get it working.

pawn Код:
stock InitializeServer()
{
    new Cache:result = mysql_query(MySQL_Connection, "SELECT * FROM `server` WHERE id = '1'");
    cache_get_field_content(0, "servermotd", ServerMOTD);
    cache_get_field_content(0, "setby", ServerMOTDby);
    cache_delete(result);
    return 1;
}
Checked multiple times, initializeserver is indeed being called.
Tried printing (debugging) and printed everything.
Tried printing the MOTD itself: empty.


Re: Query doesn't seem to work - Misiur - 23.03.2015

What does your mysql_log say?


Re: Query doesn't seem to work - Jimmy0wns - 23.03.2015

Quote:
Originally Posted by Misiur
Посмотреть сообщение
What does your mysql_log say?
No errors at all.


Re: Query doesn't seem to work - Konstantinos - 23.03.2015

After executing the query, print the number of rows using cache_num_rows so we can be sure there are some results.


Re: Query doesn't seem to work - Jimmy0wns - 23.03.2015

After doing some checks, I realized gamemodeinit gets called before main, my loading function was at gamemodeinit but my mysql initializes at main. I've put the mysql initialization at gamemode init and that worked.

- solved -