SA-MP Forums Archive
Problem with a_mysql - 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: Problem with a_mysql (/showthread.php?tid=634227)



Problem with a_mysql - akib - 15.05.2017

Hi,
When i enter this code there no error:
Код:
SetupPlayerTable()
{
	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',`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`))");
	return 1;
}
but when i customize it and add score it gives me error:

Code:
Код:
SetupPlayerTable()
{
	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',`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',`Score` mediumint(8) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
	return 1;
}
Error:
Код:
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(334) : error 075: input line too long (after substitutions)
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(335) : error 037: invalid string (possibly non-terminated string)
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(335) : error 017: undefined symbol "CREATE"
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(335) : error 017: undefined symbol "TABLE"
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(335) : fatal error 107: too many error messages on one line



Re: Problem with a_mysql - akib - 15.05.2017

Sorry fixed!


Re: Problem with a_mysql - akib - 15.05.2017

No still problem :3 same error


Re: Problem with a_mysql - iLearner - 15.05.2017

PHP код:
new query[500];
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',`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0'");
strcat(query",`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'");
strcat(query", PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
mysql_tquery(g_SQLquery""""); 
Should work, try it.


Re: Problem with a_mysql - akib - 15.05.2017

No error but also not saving


Re: Problem with a_mysql - iLearner - 15.05.2017

Try this:
PHP код:
new query[500];
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, `salt` char(16) NOT NULL,`kills` 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`))");
mysql_tquery(g_SQLquery""""); 



Re: Problem with a_mysql - akib - 15.05.2017

dude make a score saving system :/


Re: Problem with a_mysql - iLearner - 15.05.2017

Consider understanding the method instead of requesting everything pre-made, anyway here you go:

PHP код:
new query[500];
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,`salt` char(16) NOT NULL,`kills` 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',`Score` mediumint(8) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
mysql_tquery(g_SQLquery""""); 



Re: Problem with a_mysql - akib - 15.05.2017

bro make a code that also save scores :/ i am having problem while do score save

errors
Код:
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(336) : error 075: input line too long (after substitutions)
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(337) : error 037: invalid string (possibly non-terminated string)
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(337) : error 017: undefined symbol "CREATE"
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(337) : error 017: undefined symbol "TABLE"
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(337) : fatal error 107: too many error messages on one line



Re: Problem with a_mysql - DRIFT_HUNTER - 15.05.2017

Quote:
Originally Posted by akib
Посмотреть сообщение
No error but also not saving
You do realize you posted CREATE TABLE query, not saving one...Its job is to create table if one does not exists, not save something.