12.07.2012, 10:59
Hello, I am come back to samp after about a year and when i use to script, i used G-stylezz mysql plugin..
now though it has been updated massively in the R7 build and only threaded queries are allowed (which are a good thing to be fair!)
But i am having trouble with using it, i understand what the theory behind it is and i understand the flow of data, but its just not working when i put it into practice.
Here is my script i am practicing with (after following the tutorial on the new R7 build):
Although it is saying "no" in the console with the mysql_ping and the ONQueryFinished function doesnt even get called, i tested it by putting a print(); statement at the very start of the callback, but nothing happens..
and now i am doubting whether it is even connecting to the database properly...
I have already tested the connection with PHP and it works perfectly in that..
so any ideas on what im doing wrong?
now though it has been updated massively in the R7 build and only threaded queries are allowed (which are a good thing to be fair!)
But i am having trouble with using it, i understand what the theory behind it is and i understand the flow of data, but its just not working when i put it into practice.
Here is my script i am practicing with (after following the tutorial on the new R7 build):
pawn Code:
public OnGameModeInit()
{
dbhandle = mysql_connect("localhost", "root", "samp", "");
mysql_function_query(dbhandle, "SELECT * FROM accounts where Username='Darren'", true, "OnQueryFinished", "");
if(mysql_ping(dbhandle) == 1) print("yes");
else print("no");
return 1;
}
public OnQueryFinished()
{
new rows, fields;
cache_get_data(rows, fields);
if(!rows)
{
print(!"Darren is not a registered account on this server!");
}
else
{
printf("Darren is registered (1 row with %d fields)", fields);
}
return 1;
}
and now i am doubting whether it is even connecting to the database properly...
I have already tested the connection with PHP and it works perfectly in that..
so any ideas on what im doing wrong?