How to damn do this lol - 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: How to damn do this lol (
/showthread.php?tid=486460)
How to damn do this lol -
Face9000 - 08.01.2014
So i made a table in MySQL which will log server stats like total accounts and shit. I tested with the "TotalAccounts" row first:
pawn Код:
new stats[200];
format(stats, sizeof(stats), "UPDATE `ServerStats` SET `TotalAccounts` ++");
mysql_query(stats);
This is the code when someone registers, but in mysql_log.txt i get a SQL syntax error, lol.
My question is: How to increase the "TotalAccounts" row by 1?
The "TotalAccounts" is made in "integrer".
Re: How to damn do this lol -
Vince - 08.01.2014
Completely unnecessary since you have COUNT(*).
PHP код:
SELECT COUNT(*) AS TotalAccounts FROM playerdata
Will output something like
For further reference, to increment a field:
PHP код:
UPDATE table SET field = field + 1 WHERE condition = true
Re: How to damn do this lol -
Face9000 - 08.01.2014
So in this way:
pawn Код:
new stats[200];
UPDATE ServerStats SET TotalAccounts= TotalAccounts + 1 WHERE condition = true;
mysql_query(stats);
Right?
Re: How to damn do this lol -
sammp - 08.01.2014
format(stats, sizeof(stats), "UPDATE ServerStats SET TotalAccounts = TotalAccounts + 1 WHERE condition = true");
Re: How to damn do this lol -
Face9000 - 08.01.2014
Ah ye forgot the format. K thx