12.05.2013, 15:13
For the first question ill try to explain in examples:
So somewhere i have this:
And that function:
I hope you understand better. I want to return the result of "Loading" to where "stock ExistsInMysql(something[])" was called
Second question: thanks! Thats the thing i always send the full query with all the stats,even if i needed to update 1-2fields.
Third Question: but how do i use mysql_real_escape_string in samp? I dont understand WHAT do i have to escape.
Is that valid? And it only need to be done for strings?
So somewhere i have this:
pawn Код:
if(ExistsInMysql("Just some string")) { do something
pawn Код:
stock ExistsInMysql(something[]) {
new query[50];
format(query,sizeof(query),"SELECT * FROM Users WHERE Username='%s'",something);
mysql_function_query(db,query,true,"Loading","d",playerid);
}
forward Loading(playerid);
public Loading(playerid)
{
new rows,fields;
cache_get_data(rows,fields);
if(rows>0) // return something to the "if(Exists()" part
Second question: thanks! Thats the thing i always send the full query with all the stats,even if i needed to update 1-2fields.
Third Question: but how do i use mysql_real_escape_string in samp? I dont understand WHAT do i have to escape.
pawn Код:
format(query,sizeof(query),"SELECT * FROM users WHERE useraname='%s' AND password='%s'",name,pass);
mysql_real_escape_string(name,name);
mysql_real_escape_string(pass,pass);