SA-MP Forums Archive
Help me - MYSQL - 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: Help me - MYSQL (/showthread.php?tid=611686)



Help me - MYSQL - iWindows - 09.07.2016

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]


Re: Help me - MYSQL - jlalt - 09.07.2016

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); 



Re: Help me - MYSQL - Vince - 09.07.2016

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.