MySQL Update
#1

Hello guys i have a question about mysql update from r6(i think) to r41
I have this 2 things:
Код:
public MySQLCheckCar(carname[])
{
	new query[128],escstr[MAX_PLAYER_NAME];
	mysql_real_escape_string(carname, escstr);
	format(query, sizeof(query), "SELECT `ID` FROM stock WHERE `Car` = '%s'", escstr);
	mysql_query(SQL,query);
	mysql_store_result();
	if (mysql_num_rows()==0)
	{
	    mysql_free_result();
		return 0;
	}
	else
	{
		new strid[32],intid;
		mysql_fetch_row(strid);
		intid = strval(strid);
	    mysql_free_result();
		return intid;
	}
}
Код:
public MySQLCheckCar(carname[])
{
	new query[64],intid;
	mysql_format(query, sizeof(query), "SELECT `ID` FROM stock WHERE `Car` = '%e'", carname);
	mysql_tquery(SQL,query, "", "");
	if(cache_num_rows() > 0)
	{
		cache_get_value_name_int(0, "ID",intid);
		return intid;
	}
}
They do same thing? Or i need to call mysql querry first and then get cache from it?(second one)
The function is called everytime an admin set a car to the stock....
I want to learn to update from that old functions to new one, for me of course, you don't know when you need....
Reply


Messages In This Thread
MySQL Update - by Banditul18 - 10.11.2016, 07:00
Re: MySQL Update - by dicknyson - 10.11.2016, 08:29
Re: MySQL Update - by Banditul18 - 10.11.2016, 17:39

Forum Jump:


Users browsing this thread: 1 Guest(s)