Posts: 3,351
Threads: 780
Joined: Jan 2010
Since i converted my gm to mysql R39-3 can someone help me to convert this code to my current mysql version? Thanks:
Код:
new stats[128];
format(stats, sizeof(stats), "UPDATE ServerStats SET TotalAccounts = TotalAccounts + 1");
mysql_function_query(mConnectionHandle, stats, false, "", "");
Posts: 2,593
Threads: 34
Joined: Dec 2007
Posts: 3,351
Threads: 780
Joined: Jan 2010
Oh, thanks all. And now how i can read it to show a message ingame like: "There are X accounts registered"...?
Posts: 3,351
Threads: 780
Joined: Jan 2010
BroZeus since i have to place your code inside the registration callback i edited a bit:
Код:
new stats[128];
mysql_format(mConnectionHandle, stats, sizeof(stats), "UPDATE ServerStats SET TotalAccounts = TotalAccounts + 1");
mysql_tquery(mConnectionHandle, stats);
mysql_tquery(mConnectionHandle, "SELECT TotalAccounts FROM ServerStats");
new name[24];
GetPlayerName(playerid, name, sizeof(name));
format(irc,sizeof(irc),"1,3%s (%d) has registered a new account. Total accounts registered: %d",name,playerid,cache_get_row_int(0, 0, mConnectionHandle));
IRC_GroupSay(groupID, IRC_CHANNEL, irc);
IRC_GroupSay(groupID, IRC_ACHANNEL, irc);
Seems the TotalAccounts row is not updating:
Quote:
16:13:17] [DEBUG] mysql_format - connection: 0, len: 128, format: "UPDATE ServerStats SET TotalAccounts = TotalAccounts + 1"
[16:13:17] [ERROR] mysql_format - invalid connection handle (id: 0)
[16:13:17] [DEBUG] mysql_tquery - connection: 0, query: "", callback: "(null)", format: "(null)"
[16:13:17] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[16:13:17] [DEBUG] mysql_tquery - connection: 0, query: "SELECT TotalAccounts FROM ServerStats", callback: "(null)", format: "(null)"
[16:13:17] [ERROR] mysql_tquery - invalid connection handle (id: 0)
[16:13:17] [DEBUG] cache_get_row_int - row: 0, field_idx: 0, connection: 0
|
Posts: 3,351
Threads: 780
Joined: Jan 2010
....how to place that code if there is inside a public? I need the code without using a public..