I managed to do this with getting ID.
In this command I'm first inserting one free row in table with default values than I'm updating the table with info I want...
So, problem is that when I type /makebusiness, it inserts custom values, and when I type second time same command, it adds / inserts another row with custom values and edits the last one row (from first time I typed command).
First querry for inserting:
PHP код:
new query[400];
//Total_Biz_Created++;
mysql_format(Database, query, sizeof(query), "INSERT INTO `businesses` (Name, Price, ExteriorX, ExteriorY, ExteriorZ, ExteriorA, InteriorX, InteriorY, InteriorZ, InteriorA, Interior, VirtualWorld, Type) \
VALUES('BusinessRandomName', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)");
mysql_tquery(Database, query, "GetBizID", "i", playerid);
Than I put some values I want to update later...:
PHP код:
BusinessInfo[NewBiz[playerid]][Interior] = 2;
strins(BusinessInfo[NewBiz[playerid]][Name], "24/7", 0, 5);
BusinessInfo[NewBiz[playerid]][VirtualWorld] = 5;
BusinessInfo[NewBiz[playerid]][Type] = 1;
BusinessInfo[NewBiz[playerid]][Owned] = 1;
And update the table:
PHP код:
mysql_format(Database, query, sizeof(query), "UPDATE `businesses` SET `Interior` = %d, `Name` = '%e', `VirtualWorld` = %d, `Type` = %d, `Owned` = %d WHERE `SQLID` = %d LIMIT 1",
BusinessInfo[NewBiz[playerid]][Interior], BusinessInfo[NewBiz[playerid]][Name], BusinessInfo[NewBiz[playerid]][VirtualWorld], BusinessInfo[NewBiz[playerid]][Type], BusinessInfo[NewBiz[playerid]][Owned], NewBiz[playerid]);
mysql_tquery(Database, query);
It also won't update Name, it leaves it empty..