Occurs something really weird. Lets suppose I got this code:
PHP Code:
public retrieve_bans(id)
{
new error[512], errno
new Handle:sql = SQL_Connect(g_info, errno, error, 127)
new Handle:query
for(new pcount2 = 0; pcount2 <= 4; pcount2++)
{
query = SQL_PrepareQuery(sql,"SELECT `data6` FROM `characters` WHERE pj = '%s'", g_pj[pcount2][id])
if (!SQL_Execute(query))
{
server_cmd("kick #%d ^"Servidor muy ocupado^"", get_user_userid(id)) //kick him!
SQL_FreeHandle(query)
SQL_FreeHandle(sql)
return PLUGIN_HANDLED
}
else
{
SQL_NumResults(query)
g_pjban[pcount2][id] = SQL_ReadResult(query, 0)
}
}
SQL_FreeHandle(query)
SQL_FreeHandle(sql)
return PLUGIN_HANDLED
}
Everything works fine.
But lets suppose I change the query from this
PHP Code:
query = SQL_PrepareQuery(sql,"SELECT `data6` FROM `characters` WHERE pj = '%s'", g_pj[pcount2][id])
To this
PHP Code:
query = SQL_PrepareQuery(sql,"SELECT `bantime` FROM `characters` WHERE pj = '%s'", g_pj[pcount2][id])
Everything should work fine, as it does when I insert that query direct into phpMyAdmin. I just get another value from another column. Weirdly, in SQLx module it throws an annoying error
Code:
L 11/07/2009 - 15:11:41: [MySQL] No result set in this query!
L 11/07/2009 - 15:11:41: [AMXX] Displaying debug trace (plugin "test.amxx")
L 11/07/2009 - 15:11:41: [AMXX] Run time error 10: native error (native "SQL_ReadResult")
Any idea of this weird bug?