MySQL R7 question
#4

For the first question ill try to explain in examples:
So somewhere i have this:
pawn Код:
if(ExistsInMysql("Just some string")) { do something
And that function:
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
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.
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);
Is that valid? And it only need to be done for strings?
Reply


Messages In This Thread
MySQL R7 question - by dusk - 11.05.2013, 05:39
Re: MySQL R7 question - by dusk - 12.05.2013, 12:01
Re: MySQL R7 question - by Vince - 12.05.2013, 12:18
Re: MySQL R7 question - by dusk - 12.05.2013, 15:13
Re: MySQL R7 question - by Vince - 12.05.2013, 15:34
Re: MySQL R7 question - by dusk - 12.05.2013, 15:53

Forum Jump:


Users browsing this thread: 2 Guest(s)