08.02.2019, 18:19
Quote:
That garbled monstrosity of a SQL query makes me feel queasy. Why don\'t you use SQL directly to do what you want instead of going through an overhead like that? Since you only need to create the table once, it is practically dead code after the first run.
|
--------------------------------------------------------------------------------------------------
PHP Code:
mysql_tquery(mysql, "CREATE TABLE IF NOT EXISTS `playerdata` (\
`ID` INT NOT NULL AUTO_INCREMENT,\
`Level` INT NOT NULL,\
`NormalName` VARCHAR(25) NOT NULL,\
`AdmLevel` INT NOT NULL,\
`AdmDuty` INT NOT NULL,\
`AdmName` VARCHAR(25) NOT NULL,\
`HelpLevel` INT NOT NULL,\
`Pass` VARCHAR(255) NOT NULL,\
`Email` VARCHAR(128) NOT NULL,\
`RegisterOn` VARCHAR(128) NOT NULL,\
`MapLeader` INT NOT NULL,\
`Mapper` INT NOT NULL,\
`Donator` INT NOT NULL,\
`Banned` INT NOT NULL,\
`BannedBy` VARCHAR(25) NOT NULL,\
`BanReason` VARCHAR(500) NOT NULL,\
`IP` VARCHAR(255) NOT NULL,\
`Logged` INT NOT NULL,\
`Age` INT NOT NULL,\
`Gender` INT NOT NULL,\
`Skin` INT NOT NULL,\
`LastPosX` FLOAT NOT NULL,\
`LastPosY` FLOAT NOT NULL,\
`LastPosZ` FLOAT NOT NULL,\
`LastPosA` FLOAT NOT NULL,\
`LastInt` INT NOT NULL,\
`LastVw` INT NOT NULL,\
`Warns` INT NOT NULL,\
`Gang` INT NOT NULL,\
`Faction` INT NOT NULL,\
`FactDuty` INT NOT NULL,\
`Leader` INT NOT NULL,\
`Rank` INT NOT NULL,\
`Job` INT NOT NULL,\
`Job2` INT NOT NULL,\
`Money` INT NOT NULL,\
`Bank` INT NOT NULL,\
`Crimes` INT NOT NULL,\
`Arrested` INT NOT NULL,\
`WantedLevel` INT NOT NULL,\
`Health` FLOAT NOT NULL,\
`Armour` FLOAT NOT NULL,\
`Pot` INT NOT NULL,\
`Cocaine` INT NOT NULL,\
`Package` INT NOT NULL,\
`Crate` INT NOT NULL,\
`Radio` INT NOT NULL,\
`RadioFreq` INT NOT NULL,\
`PhoneBook` INT NOT NULL,\
`Mats` INT NOT NULL,\
`Rope` INT NOT NULL,\
`Weap0` INT NOT NULL,\
`Weap1` INT NOT NULL,\
`Weap2` INT NOT NULL,\
`Weap3` INT NOT NULL,\
`Weap4` INT NOT NULL,\
`Weap5` INT NOT NULL,\
`Weap6` INT NOT NULL,\
`Weap7` INT NOT NULL,\
`Weap8` INT NOT NULL,\
`Weap9` INT NOT NULL,\
`Weap10` INT NOT NULL,\
`Weap11` INT NOT NULL,\
`Weap12` INT NOT NULL,\
`WeapAmmo0` INT NOT NULL,\
`WeapAmmo1` INT NOT NULL,\
`House` INT NOT NULL,\
`House2` INT NOT NULL,\
`Renting` INT NOT NULL,\
`Jailed` INT NOT NULL,\
`JailTime` INT NOT NULL,\
`JailedBy` VARCHAR(25) NOT NULL,\
`JailReason` VARCHAR(500) NOT NULL,\
`HasReport` INT NOT NULL,\
`ReportContent` VARCHAR(500) NOT NULL,\
`ReviewingReport` INT NOT NULL,\
`Accent` INT NOT NULL,\
`NewbMute` INT NOT NULL,\
`togNewbie` INT NOT NULL,\
`OOCMute` INT NOT NULL,\
`togOOC` INT NOT NULL,\
`AdMute` INT NOT NULL,\
`NormMute` INT NOT NULL,\
`Married` INT NOT NULL,\
`MarriedTo` VARCHAR(25) NOT NULL,\
`ReferredBy` VARCHAR(25) NOT NULL,\
`Tokens` INT NOT NULL,\
`RequestedHelp` INT NOT NULL,\
`HelpReason` VARCHAR(500) NOT NULL,\
`LastHour` INT NOT NULL,\
`LastMinute` INT NOT NULL,\
`LastDay` INT NOT NULL,\
`LastMonth` INT NOT NULL,\
`LastYear` INT NOT NULL,\
`LastIP` VARCHAR(255) NOT NULL,\
PRIMARY KEY (`ID`))");
I got these errors:
Code:
(349) : error 075: input line too long (after substitutions)
(350) : error 037: invalid string (possibly non-terminated string)
(350) : error 017: undefined symbol "CREATE"
(350) : error 017: undefined symbol "TABLE"
(350) : fatal error 107: too many error messages on one line
Line 349:
Code:
`BannedBy` VARCHAR(25) NOT NULL,\
Line 350:
Code:
`BanReason` VARCHAR(500) NOT NULL,\
so I split them then it runs without errors, but It\'s actually not working.
pawn Code:
new string[5000];
strcat(string,"CREATE TABLE IF NOT EXISTS `playerdata` (\
`ID` INT NOT NULL AUTO_INCREMENT,\
`Level` INT NOT NULL,\
`NormalName` VARCHAR(25) NOT NULL,\
`AdmLevel` INT NOT NULL,\
`AdmDuty` INT NOT NULL,\
`AdmName` VARCHAR(25) NOT NULL,\
`HelpLevel` INT NOT NULL,\
`Pass` VARCHAR(255) NOT NULL,\
`Email` VARCHAR(128) NOT NULL,\
`RegisterOn` VARCHAR(128) NOT NULL,\
`MapLeader` INT NOT NULL,\
`Mapper` INT NOT NULL,\
`Donator` INT NOT NULL,\
`Banned` INT NOT NULL,");
strcat(string, "`BannedBy` VARCHAR(25) NOT NULL,\
`BanReason` VARCHAR(500) NOT NULL,\
`IP` VARCHAR(255) NOT NULL,\
`Logged` INT NOT NULL,\
`Age` INT NOT NULL,\
`Gender` INT NOT NULL,\
`Skin` INT NOT NULL,\
`LastPosX` FLOAT NOT NULL,\
`LastPosY` FLOAT NOT NULL,\
`LastPosZ` FLOAT NOT NULL,\
`LastPosA` FLOAT NOT NULL,\
`LastInt` INT NOT NULL,\
`LastVw` INT NOT NULL,\
`Warns` INT NOT NULL,\
`Gang` INT NOT NULL,");
strcat(string, "Faction` INT NOT NULL,\
`FactDuty` INT NOT NULL,\
`Leader` INT NOT NULL,\
`Rank` INT NOT NULL,\
`Job` INT NOT NULL,\
`Job2` INT NOT NULL,\
`Money` INT NOT NULL,\
`Bank` INT NOT NULL,\
`Crimes` INT NOT NULL,\
`Arrested` INT NOT NULL,\
`WantedLevel` INT NOT NULL,\
`Health` FLOAT NOY NULL,\
`Armour` FLOAT NOT NULL,\
`Pot` INT NOT NULL,\
`Cocaine` INT NOT NULL,\
`Package` INT NOT NULL,\
`Crate` INT NOT NULL,\
`Radio` INT NOT NULL,\
`RadioFreq` INT NOT NULL,\
`PhoneBook` INT NOT NULL,");
strcat(string, "`Mats` INT NOT NULL,\
`Rope` INT NOT NULL,\
`Weap0` INT NOT NULL,\
`Weap1` INT NOT NULL,\
`Weap2` INT NOT NULL,\
`Weap3` INT NOT NULL,\
`Weap4` INT NOT NULL,\
`Weap5` INT NOT NULL,\
`Weap6` INT NOT NULL,\
`Weap7` INT NOT NULL,\
`Weap8` INT NOT NULL,\
`Weap9` INT NOT NULL,\
`Weap10` INT NOT NULL,\
`Weap11` INT NOT NULL,\
`Weap12` INT NOT NULL,\
`WeapAmmo0` INT NOT NULL,\
`WeapAmmo1` INT NOT NULL,\
`House` INT NOT NULL,\
`House2` INT NOT NULL,\
`Renting` INT NOT NULL,\
`Jailed` INT NOT NULL,");
strcat(string, "`JailTime` INT NOT NULL,\
`JailedBy` VARCHAR(25) NOT NULL,\
`JailReason` VARCHAR(500) NOT NULL,\
`HasReport` INT NOT NULL,\
`ReportContent` VARCHAR(500) NOT NULL,\
`ReviewingReport` INT NOT NULL,\
`Accent` INT NOT NULL,\
`NewbMute` INT NOT NULL,\
`togNewbie` INT NOT NULL,\
`OOCMute` INT NOT NULL,\
`togOOC` INT NOT NULL,\
`AdMute` INT NOT NULL,\
`NormMute` INT NOT NULL,\
`Married` INT NOT NULL,\
`MarriedTo` VARCHAR(25) NOT NULL,\
`ReferredBy` VARCHAR(25) NOT NULL,\
`Tokens` INT NOT NULL,");
strcat(string, "`RequestedHelp` INT NOT NULL,\
`HelpReason` VARCHAR(500) NOT NULL,\
`LastHour` INT NOT NULL,\
`LastMinute` INT NOT NULL,\
`LastDay` INT NOT NULL,\
`LastMonth` INT NOT NULL,\
`LastYear` INT NOT NULL,\
`LastIP` VARCHAR(255) NOT NULL,\
PRIMARY KEY (`ID`))");
mysql_tquery(mysql, string);
PHP Code:
`AdmDuty` INT NOT NULL,\
`AdmName` VARCHAR(25) NOT NULL,\
`HelpLevel` INT NOT NULL,\
`MapLeader` INT NOT NULL,\
`Mapper` INT NOT NULL,\
PHP Code:
`Pass` VARCHAR(255) NOT NULL,\
PHP Code:
`Banned` INT NOT NULL,\
`BannedBy` VARCHAR(25) NOT NULL,\
`BanReason` VARCHAR(500) NOT NULL,\
PHP Code:
`RegisterOn` VARCHAR(128) NOT NULL,\
PHP Code:
`IP` VARCHAR(255) NOT NULL,\
`LastIP` VARCHAR(255) NOT NULL,\
PHP Code:
`Logged` INT NOT NULL,\
PHP Code:
`Weap0` INT NOT NULL,\
`Weap1` INT NOT NULL,\
`Weap2` INT NOT NULL,\
`Weap3` INT NOT NULL,\
`Weap4` INT NOT NULL,\
`Weap5` INT NOT NULL,\
`Weap6` INT NOT NULL,\
`Weap7` INT NOT NULL,\
`Weap8` INT NOT NULL,\
`Weap9` INT NOT NULL,\
`Weap10` INT NOT NULL,\
`Weap11` INT NOT NULL,\
`Weap12` INT NOT NULL,\
`WeapAmmo0` INT NOT NULL,\
`WeapAmmo1` INT NOT NULL,\
PHP Code:
`House` INT NOT NULL,\
`House2` INT NOT NULL,\
`Renting` INT NOT NULL,\
PHP Code:
`LastHour` INT NOT NULL,\
`LastMinute` INT NOT NULL,\
`LastDay` INT NOT NULL,\
`LastMonth` INT NOT NULL,\
`LastYear` INT NOT NULL,\