MySQL not saving new row
#2

Why do you need two queries? An INSERT is enough to insert the correct world. For some reason you have two columns `worldid` and `world` according to your code.

Second important note is that you may execute a query but you cannot be certain it was successful. This is the wrong way:
pawn Code:
mysql_tquery(..., "DELETE ...");
WeedPlants[weedid][...] = 0;
If the query fails for whatever reason, you destroyed them in-game but not on database. The correct way is:
pawn Code:
mysql_tquery(..., "DELETE ...", "OnWeedPlantsDeleted", "d", weedid);
pawn Code:
forward OnWeedPlantsDeleted(weedid);
public OnWeedPlantsDeleted(weedid)
{
    WeedPlants[weedid][...] = 0;
}
This is also wrong:
pawn Code:
WeedPlants[weedid][ID] = cache_insert_id();
No active cache.
Reply


Messages In This Thread
MySQL not saving new row - by SkyFlare - 01.01.2019, 12:08
Re: MySQL not saving new row - by Calisthenics - 01.01.2019, 13:43
Re: MySQL not saving new row - by Banditul18 - 01.01.2019, 14:21

Forum Jump:


Users browsing this thread: 1 Guest(s)