Help me - MYSQL

I'm trying to create tables like... LogFactionID12, LogFactionID52... but i don't have ideia how to put that in code..

mysql_tquery(g_iHandle,"CREATE TABLE `LogFaccaoID(Herethenumber)` (`ID` INT(12) AUTO_INCREMENT,`Data` VARCHAR(64) DEFAULT 'NULL',`Nome` VARCHAR(25) DEFAULT 'NULL',`Arma` VARCHAR(25) DEFAULT 'NULL', PRIMARY KEY(`ID`));");
How could i put a variable in 'Herethenumber' like... new Herethenumber = FactionData[factionid][factionID]

you can use a string and format it like below codes

PHP код:
new Query[250], Herethenumber FactionData[factionid][factionID];
format(Query,sizeof Query,"CREATE TABLE `LogFaccaoID%d` (`ID` INT(12) AUTO_INCREMENT,`Data` VARCHAR(64) DEFAULT 'NULL',`Nome` VARCHAR(25) DEFAULT 'NULL',`Arma` VARCHAR(25) DEFAULT 'NULL', PRIMARY KEY(`ID`))",Herethenumber);

This is not the way to do it. If you're just storing some logs, confine them to a single table and store FaccaoID (= factionID?) in a column in the table. Doesn't matter if you get millions of rows. MySQL can handle that.

Forum Jump:

Users browsing this thread: 1 Guest(s)