08.09.2012, 21:42
I was trying to count number of rows from a table but for some reason I get the wrong result.
I have used this query:
I ran this query on phpmyadmin and I got the right result there, but not in pawn.
Here is the function, perhaps I used the mysql functions incorrectly?
I am using BlueG's MySQL Plugin version R6-2 (non cached queries)
P.S. it is always returning 1
I have used this query:
pawn Код:
"SELECT COUNT(*) FROM `"TABLE_INBOX"` WHERE `linkedto` = %d AND `read` = 0"
Here is the function, perhaps I used the mysql functions incorrectly?
pawn Код:
stock MySQL_InboxMessages(account_sqlid)
{
new
sql_result;
format(szQuery, sizeof(szQuery), "SELECT COUNT(*) FROM `"TABLE_INBOX"` WHERE `linkedto` = %d AND `read` = 0", account_sqlid);
mysql_query(szQuery);
mysql_store_result();
sql_result = mysql_num_rows();
mysql_free_result();
return sql_result;
}
P.S. it is always returning 1