MYSQL: How do I detect all tables existing data?
#1

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`))"); 
Reply
#2

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.
Reply
#3

Great idea! thanks!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)