[Help] MySQL returning wrong result
#1

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:
pawn Код:
"SELECT COUNT(*) FROM `"TABLE_INBOX"` WHERE `linkedto` = %d AND `read` = 0"
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?

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;
}
I am using BlueG's MySQL Plugin version R6-2 (non cached queries)

P.S. it is always returning 1
Reply


Messages In This Thread
[Help] MySQL returning wrong result - by Maxips2 - 08.09.2012, 21:42
Re: [Help] MySQL returning wrong result - by Kirollos - 08.09.2012, 21:43
Re: [Help] MySQL returning wrong result - by Maxips2 - 08.09.2012, 21:46
Re: [Help] MySQL returning wrong result - by Chenko - 08.09.2012, 21:50
Re: [Help] MySQL returning wrong result - by Maxips2 - 08.09.2012, 21:51
Re: [Help] MySQL returning wrong result - by Kirollos - 08.09.2012, 22:08
Re: [Help] MySQL returning wrong result - by Maxips2 - 08.09.2012, 22:11

Forum Jump:


Users browsing this thread: 1 Guest(s)