[MYSQL] Problem
#1

Hi guys )
I have problem with that:
Код:
CMD:delete(playerid, params[]) {
	if(isnull(params))
	{
		SendClientMessage(playerid, COLOR_RED, "[ERROR] Use: "CWHITE"/delete [ID]");
		return 1;
	}
	
	new id = strval(params);
	format(query, sizeof(query), "SEELCT `UID` FROM `mapa_shop` WHERE `UID` = '%d'",id);
	mysql_query(query);
	if(!mysql_num_rows())
	{
		format(dstring,sizeof(dstring),"[ERROR] The database does not have a shop with UID:"CWHITE" %d",id);
		SendClientMessage(playerid, COLOR_RED, dstring);
		return 1;
	}
	ReloadShop();
	format(query, sizeof(query), "DELETE FROM `mapa_shop` WHERE `UID` = '%d'",id);
	mysql_query(query);
	return 1;
}
I don't know how to check, if the UID of the shop exists in the database. If not the server shows error. Can you help me ?
Reply
#2

I believe mysql_affected_rows/cache_affected_rows will return the number of rows deleted so there is no need to check beforehand.
Reply
#3

So, how it might look ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)