Help me - MYSQL
#1

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]
Reply
#2

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);
mysql_tquery(g_iHandle,Query); 
Reply
#3

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


Forum Jump:


Users browsing this thread: 1 Guest(s)