Why it's not working ? - 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: Why it's not working ? (
/showthread.php?tid=655143)
Why it's not working ? -
Nru - 14.06.2018
PHP Code:
string = "CREATE TABLE IF NOT EXISTS masters (MASTER_ID int(11) NOT NULL AUTO_INCREMENT,\
NAME varchar(24) NOT NULL,\
IP varchar(24) NOT NULL,\
PASSWORD char(65) NOT NULL,\
SALT char(11) NOT NULL,\
BAN tinyint(1) NOT NULL DEFAULT '0',\
DATE int(11) NOT NULL DEFAULT '0',\
EXPIRATION int(11) NOT NULL DEFAULT '0',\
CHAR_ID[0] int(11) NOT NULL DEFAULT '0',\
CHAR_ID[1] int(11) NOT NULL DEFAULT '0',\
CHAR_ID[2] int(11) NOT NULL DEFAULT '0', PRIMARY KEY (ID), UNIQUE KEY NAME (NAME))";
mysql_tquery(Database, string);
I get this error
Code:
[18:42:21] [plugins/mysql] error #1064 while executing query "CREATE TABLE IF NOT EXISTS masters (ID int(11) NOT NULL AUTO_INCREMENT,NAME varchar(24) NOT NULL,IP varchar(24) NOT NULL,PASSWORD char(65) NOT NULL,SALT char(11) NOT NULL,BAN tinyint(1) NOT NULL DEFAULT '0',DATE int(11) NOT NULL DEFAULT '0',EXPIRATION int(11) NOT NULL DEFAULT '0',CHAR_ID[0] int(11) NOT NULL DEFAULT '0',CHAR_ID[1] int(11) NOT NULL DEFAULT '0',CHAR_ID[2] int(11) NOT NULL DEFAULT '0', PRIMARY KEY (ID), UNIQUE KEY NAME (NAME))": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '[0] int(11) NOT NULL DEFAULT '0',CHAR_ID[1] int(11) NOT NULL DEFAULT '0',' at line 1
Why is the [] are not working
Re: Why it's not working ? -
Nru - 14.06.2018
Any help ??
Re: Why it's not working ? -
GTLS - 14.06.2018
Not 100% sure but I believe, MySQL Column names with brackets has different function so Its not gonna let you use them. You can use like, CHAR_ID_0, CHAR_ID_1 etc...