30.01.2013, 08:42
(
Последний раз редактировалось Neil.; 06.10.2014 в 00:02.
)
fixed
Use the function mysql_num_rows It counts all the rows for ya!
|
stock bancount(playerid)
{
format(Query, sizeof(Query), "SELECT * FROM `banlog` WHERE (`name` = '%s' OR `ip` = '%s') AND `banned` = 1 LIMIT 1", escpname(playerid), PIP);
mysql_store_result();
new rows = mysql_num_rows();
mysql_free_result();
return rows;
}
new row[24];
mysql_query( "SELECT COUNT(`name`) FROM `banlog` WHERE (`name` = '%s' OR `ip` = '%s') AND `banned` = '1'" );
mysql_store_result();
mysql_fetch_row(row,"|")
new Count = strval(row);
mysql_free_result();
Your query syntax is abit wrong, it will always select only one row, as you set LIMIT 1, in your case you should use
pawn Код:
|
stock bancount(playerid)
{
new row[24];
mysql_query( "SELECT COUNT(`name`) FROM `banlog` WHERE (`name` = '%s' OR `ip` = '%s') AND `banned` = '1'" );
mysql_store_result();
mysql_fetch_row(row,"|");
new Count = strval(row);
mysql_free_result();
return rows;
}
format(string2, 130, "{FFFFFF}%s banned {FF9900}%s(%d){FFFFFF} for Spamming. %s banned %d players",anticheat, sendername,playerid,anticheat,bancount);
SELECT COUNT(*) FROM `banlog` WHERE `banned` = 1 GROUP BY name
Код:
SELECT COUNT(*) FROM `banlog` WHERE `banned` = 1 GROUP BY name |
stock bancount(playerid)
{
new row[24];
mysql_query( "SELECT COUNT(`name`) FROM `banlog` WHERE `banned` = '1' GROUP BY name" );
mysql_store_result();
mysql_free_result();
return 1;
}