SA-MP Forums Archive
Helppp MySQL Create Table Problem - 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: Helppp MySQL Create Table Problem (/showthread.php?tid=655044)



Helppp MySQL Create Table Problem - kml - 11.06.2018

Hi i have a problem with MySQL

ERRORS:
Quote:

gm.pwn(881) : error 075: input line too long (after substitutions)
gm.pwn(882) : error 037: invalid string (possibly non-terminated string)
gm.pwn(882) : error 017: undefined symbol "CREATE"
gm.pwn(882) : error 017: undefined symbol "TABLE"
gm.pwn(882) : fatal error 107: too many error messages on one line

CODE:
Quote:

stock MySQL_SetUpTables()
{
mysql_tquery(SQL_ID, "CREATE TABLE IF NOT EXISTS `accounts` ( \
`uid` INT(11) NOT NULL AUTO_INCREMENT, \
`name` TEXT NOT NULL COLLATE 'utf8_polish_ci', \
`password` TEXT NOT NULL COLLATE 'utf8_polish_ci', \
`skinid` INT(11) NOT NULL, \
`money` INT(11) NOT NULL DEFAULT '0', \
`gender` INT(11) NOT NULL, \
`age` INT(11) NOT NULL, \
`level` INT(11) NOT NULL DEFAULT '1', \
`adminlvl` INT(11) NOT NULL DEFAULT '0', \
`lastip` TEXT NOT NULL COLLATE 'utf8_polish_ci', \
`lastonline` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, \
`createdate` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, \
PRIMARY KEY (`uid`))");
return 1;
}

881 line is `lastonline`


Re: Helppp MySQL Create Table Problem - Logic_ - 11.06.2018

You need to use a string and then format and execute it.

Just a general question: Are you using the stock compiler?


Re: Helppp MySQL Create Table Problem - kml - 11.06.2018

I dont know what you mean ;/ Here is all code

https://pastebin.com/vuA9sMJ8


Re: Helppp MySQL Create Table Problem - Slawi - 13.06.2018

Change DATETIME to timestamp

LIKE:
PHP код:
stock MySQL_SetUpTables()
{
mysql_tquery(SQL_ID"CREATE TABLE IF NOT EXISTS `accounts` ( \
`uid` INT(11) NOT NULL AUTO_INCREMENT, \
`name` TEXT NOT NULL COLLATE 'utf8_polish_ci', \
`password` TEXT NOT NULL COLLATE 'utf8_polish_ci', \
`skinid` INT(11) NOT NULL, \
`money` INT(11) NOT NULL DEFAULT '0', \
`gender` INT(11) NOT NULL, \
`age` INT(11) NOT NULL, \
`level` INT(11) NOT NULL DEFAULT '1', \
`adminlvl` INT(11) NOT NULL DEFAULT '0', \
`lastip` TEXT NOT NULL COLLATE 'utf8_polish_ci', \
`lastonline` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, \ //here
`createdate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, \ //here
PRIMARY KEY (`uid`))"
); 
return 
1;