[SQLx] SelectHandle returns 0
Heya.
My SelectHandle is returning 0 for some reason.
I can't for the life of me figure out why. It's probably something simple, but I'm most likely too tired to see it.
PHP Code:
#include <amxmodx>
#include <sqlx>
// Ur Mysql Information
new Host[] = "localhost";
new User[] = "root";
new Pass[] = "";
new Db[] = "counterstrike";
new Handle:SqlConnection;
new Handle:g_SqlTuple;
new g_Error[512];
public plugin_init()
{
register_plugin( "Plugin Name", "0.1", "P1raten" );
register_clcmd("say","CmdSay");
g_SqlTuple = SQL_MakeDbTuple(Host,User,Pass,Db);
new ErrorCode;
SqlConnection = SQL_Connect(g_SqlTuple,ErrorCode,g_Error,charsmax(g_Error));
if(SqlConnection == Empty_Handle)
set_fail_state(g_Error);
SQL_FreeHandle(SqlConnection);
}
public CmdSay(id)
{
new originPlayer[32];
get_user_name(id, originPlayer, charsmax(originPlayer));
static Args[6][33], singleArg[33];
new Num = read_argc();
for(new Count = 1; Count <= Num; Count++)
read_argv(Count, Args[Count - 1], 32);
read_argv(2, singleArg, 32);
if(!equali(Args[0], "/mysql"))
return;
else
SQL_ThreadQuery(g_SqlTuple, "SelectHandle", "SELECT * FROM tablename");
}
public SelectHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
if(FailState == TQUERY_CONNECT_FAILED)
return set_fail_state("Could not connect to SQL database.")
else if(FailState == TQUERY_QUERY_FAILED)
return set_fail_state("Query failed.")
if(Errcode)
return log_amx("Error on query: %s",Error)
new DataNum
while(SQL_MoreResults(Query))
{
DataNum = SQL_ReadResult(Query,0)
server_print("zomg, some data: %d",DataNum)
SQL_NextRow(Query)
}
return PLUGIN_CONTINUE
}
:roll:
|