MYSQL: How do I detect all tables existing data? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MYSQL: How do I detect all tables existing data? (
/showthread.php?tid=659437)
MYSQL: How do I detect all tables existing data? -
v1k1nG - 03.10.2018
Hello everyone.
I am trying to load different objects a player can create in game. When it happens, a new row in "player's objects" table saving the object id, coords offset, and so on will be created.
My problem is that I need to load all the saved objects when starting the gamemode, not everytime a player logs in, and so I do not have player's name to load data. This is that table I was talking about
PHP код:
strcat(DB_Query, "CREATE TABLE IF NOT EXISTS `%e`", P[playerid][Name]);
strcat(DB_Query,"(`ID` int(11) NOT NULL AUTO_INCREMENT,");
strcat(DB_Query,"`USERNAME` varchar(24) NOT NULL,");
strcat(DB_Query,"`POSX` float(12),");
strcat(DB_Query,"`POSY` float(12),");
strcat(DB_Query,"`POSZ` float(12),");
strcat(DB_Query,"`ROTX` float(12),");
strcat(DB_Query,"`ROTY` float(12),");
strcat(DB_Query,"`ROTZ` float(12),");
strcat(DB_Query,"`OBJECTID` mediumint(7) NOT NULL,");
strcat(DB_Query,"PRIMARY KEY (`ID`),UNIQUE KEY `USERNAME` (`USERNAME`))");
Re: MYSQL: How do I detect all tables existing data? -
Calisthenics - 03.10.2018
Use two tables.
One that generates a unique map ID and has details such as author (probably a name or description to be able to identify a map easier).
The second table (child) uses the map ID as reference and contains the object model and positioning.
All you have to do now is select all objects from child table.
Re: MYSQL: How do I detect all tables existing data? -
v1k1nG - 03.10.2018
Great idea! thanks!