11.09.2011, 13:11
hey guys,
ive got a problem. i want to check banned users in a mysql table. a timer should update the bantime every minute.
code is:
new data[256];
mysql_query("SELECT * FROM accounts");
mysql_store_result();
while(mysql_fetch_row(data))
{
name[52], time[52];
mysql_fetch_field("name", name);
mysql_fetch_field("ban", time);
if(strval(time) > 0)
{
new query[128];
format(query, 128, "UPDATE accounts SET ban = '%d' WHERE name = '%s'", strval(time) - 1, name);
mysql_query(query);
}
}
mysql_free_result();
the problem: the code updates the bantime of the first valid player with bantime > 0. But after this, when the next valid player with bantime > 0 is detectet samp prints in server.log:
[01:37:41] [MySQL] Error (0): Function: mysql_store_result called when no result stored.
Can anyone help?
ive got a problem. i want to check banned users in a mysql table. a timer should update the bantime every minute.
code is:
new data[256];
mysql_query("SELECT * FROM accounts");
mysql_store_result();
while(mysql_fetch_row(data))
{
name[52], time[52];
mysql_fetch_field("name", name);
mysql_fetch_field("ban", time);
if(strval(time) > 0)
{
new query[128];
format(query, 128, "UPDATE accounts SET ban = '%d' WHERE name = '%s'", strval(time) - 1, name);
mysql_query(query);
}
}
mysql_free_result();
the problem: the code updates the bantime of the first valid player with bantime > 0. But after this, when the next valid player with bantime > 0 is detectet samp prints in server.log:
[01:37:41] [MySQL] Error (0): Function: mysql_store_result called when no result stored.
Can anyone help?