Query doesn't seem to work
#1

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.
Reply
#2

What does your mysql_log say?
Reply
#3

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

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

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 -
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)