SA-MP Forums Archive
MySQL question - 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 question (/showthread.php?tid=627508)



MySQL question - AndreiWow - 28.01.2017

Can someone give me a example of create table from gamemode, I want to test if the mysql connected and there is no good mysql wiki


Re: MySQL question - Dayrion - 28.01.2017

Depends of the version of MySQL you use. I probably don't use the best way to create table but.. it's a way (Vince will probably say the code sucks and say why, take care of that - he is godlike).
PHP код:
    new query[590];
    
format(querysizeof(query), "CREATE TABLE IF NOT EXISTS `Tag` (`SQLIB` INTEGER PRIMARY KEY AUTO_INCREMENT, `ID` INT NOT NULL DEFAULT '0', `Owner` VARCHAR(25) NOT NULL DEFAULT '', `Text` VARCHAR(21) NOT NULL DEFAULT '', `x` FLOAT NOT NULL DEFAULT '0.0', `y` FLOAT NOT NULL DEFAULT '0.0', `z` FLOAT NOT NULL DEFAULT '0.0', `rX` FLOAT NOT NULL DEFAULT '0.0'");
    
strcat(query", `rY` FLOAT NOT NULL DEFAULT '0.0', `rZ` FLOAT NOT NULL DEFAULT '0.0', `Police` VARCHAR(31) NOT NULL DEFAULT '', `VirtualWorld` INT NOT NULL DEFAULT '0', `Interior` INT NOT NULL DEFAULT '0', `Exist` INT NOT NULL DEFAULT '0', `Color` INT NOT NULL DEFAULT '0')");
    
mysql_query(MySQLquery);
    
mysql_pquery(MySQL"SELECT * FROM Tag""OnTagLoading""");