SA-MP Forums Archive
mysql error help - 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 error help (/showthread.php?tid=637791)



mysql error help - ZukerCup - 21.07.2017

Hello guys anyone can help me please, i'm making a table in the script and i got an error and i don't know how to fix

This is the code.
Код:
mysql_tquery(g_SQL, "CREATE TABLE IF NOT EXISTS `players` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(24) NOT NULL,`password` char(64) NOT NULL,`salt` char(16) NOT NULL,`kills` mediumint(8) NOT NULL DEFAULT '0',`adminLevel` mediumint(8) NOT NULL DEFAULT '0',`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0',`y` float NOT NULL DEFAULT '0',`z` float NOT NULL DEFAULT '0',`angle` float NOT NULL DEFAULT '0',`interior` tinyint(3) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
And this is the error that i got.

Код:
C:\amir\samp037_svr_R2-1-1_win32\filterscripts\Admin.pwn(303) : error 075: input line too long (after substitutions)
C:\amir\samp037_svr_R2-1-1_win32\filterscripts\Admin.pwn(304) : error 037: invalid string (possibly non-terminated string)
C:\amir\samp037_svr_R2-1-1_win32\filterscripts\Admin.pwn(304) : error 017: undefined symbol "CREATE"
C:\amir\samp037_svr_R2-1-1_win32\filterscripts\Admin.pwn(304) : error 017: undefined symbol "TABLE"
C:\amir\samp037_svr_R2-1-1_win32\filterscripts\Admin.pwn(304) : fatal error 107: too many error messages on one line



Re: mysql error help - ZukerCup - 21.07.2017

Anybody ??


Re: mysql error help - jlalt - 21.07.2017

The line you wrote is just too long.
define new variable with the needed size then use strcat function to put the data inside it.

https://sampwiki.blast.hk/wiki/Strcat


Re: mysql error help - ZukerCup - 21.07.2017

Quote:
Originally Posted by jlalt
Посмотреть сообщение
The line you wrote is just too long.
define new variable with the needed size then use strcat function to put the data inside it.

https://sampwiki.blast.hk/wiki/Strcat
Thanks mate.


Re: mysql error help - ZukerCup - 21.07.2017

Can U Tell me how to use the strcat function ? please


Re: mysql error help - jlalt - 21.07.2017

here you go
PHP код:
new query[440]; // <- edit this if didn't fit
strcat(query"CREATE TABLE IF NOT EXISTS `players` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(24) NOT NULL,`password` char(64) NOT NULL,");
strcat(query"`salt` char(16) NOT NULL,`kills` mediumint(8) NOT NULL DEFAULT '0',`adminLevel` mediumint(8) NOT NULL DEFAULT '0',");
strcat(query"`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0',`y` float NOT NULL DEFAULT '0',`z` float NOT NULL DEFAULT '0',");
strcat(query"`angle` float NOT NULL DEFAULT '0',`interior` tinyint(3) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
mysql_tquery(g_SQLquery); 



Re: mysql error help - ZukerCup - 21.07.2017

Quote:
Originally Posted by jlalt
Посмотреть сообщение
here you go
PHP код:
new query[440]; // <- edit this if didn't fit
strcat(query"CREATE TABLE IF NOT EXISTS `players` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(24) NOT NULL,`password` char(64) NOT NULL,");
strcat(query"`salt` char(16) NOT NULL,`kills` mediumint(8) NOT NULL DEFAULT '0',`adminLevel` mediumint(8) NOT NULL DEFAULT '0',");
strcat(query"`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0',`y` float NOT NULL DEFAULT '0',`z` float NOT NULL DEFAULT '0',");
strcat(query"`angle` float NOT NULL DEFAULT '0',`interior` tinyint(3) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
mysql_tquery(g_SQLquery); 
Thanks a lot man. <3