SA-MP Forums Archive
Error ID: 1064, You have an error in your SQL syntax - 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: Error ID: 1064, You have an error in your SQL syntax (/showthread.php?tid=546184)



Error ID: 1064, You have an error in your SQL syntax - cickis3 - 13.11.2014

Код:
[21:11:59] >> mysql_query( Connection handle: 1 )

[21:11:59] CMySQLHandler::Query(INSERT INTO `BanNames` (`Name`,`BanAdmin`,`BanReason`,`BanSeconds`,`BanMinutes`,`BanHours`,`BanDay`,`BanMonth`,`BanYear`) VALUES ('Mantvis_Sireika','Mantvis_Sireika','TESTAS','59','11','21','13','11') - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1)

[21:11:59] >> mysql_query( Connection handle: 1 )
mysql log

Код:
stock BanName(name[],reason[],admin[])
{
    new string[200];
	if(!IsBannedName(name))
	{
	    new day, month, year, seconds, minutes, hours;
	    gettime(hours,minutes,seconds);
		getdate(year,month,day);
	    format(string, sizeof(string), "INSERT INTO `BanNames` (`Name`,`BanAdmin`,`BanReason`,`BanSeconds`,`BanMinutes`,`BanHours`,`BanDay`,`BanMonth`,`BanYear`) VALUE ('%s','%s','%s','%d','%d','%d','%d','%d','%d')",name,admin,reason,seconds,minutes,hours,day,month,year);
	    mysql_query(string);
	}
	return true;
}
I can't ban. Bans won't save in Mysql DB


Re: Error ID: 1064, You have an error in your SQL syntax - TakeiT - 13.11.2014

It tells you the problem, you have an error in your syntax. being that it's empty, means that it's not being inserted. Which means the string size is too short. Increase string to like 400 then try again


Re: Error ID: 1064, You have an error in your SQL syntax - Dziugsas - 13.11.2014

pawn Код:
stock BanName(name[],reason[],admin[])
{
    new string[200];
    if(!IsBannedName(name))
    {
        new day, month, year, seconds, minutes, hours;
        gettime(hours,minutes,seconds);
        getdate(year,month,day);
        format(string, sizeof(string), "INSERT INTO BanNames (`Name`,`BanAdmin`,`BanReason`,`BanSeconds`,`BanMinutes`,`BanHours`,`BanDay`,`BanMonth`,`BanYear`) VALUE ('%s','%s','%s','%d','%d','%d','%d','%d','%d')",name,admin,reason,seconds,minutes,hours,day,month,year);
        mysql_query(string);
    }
    return true;
}
Here you go.Database name BanNames shouldn't be in ''.


Re: Error ID: 1064, You have an error in your SQL syntax - TakeiT - 13.11.2014

Quote:
Originally Posted by Dziugsas
Посмотреть сообщение
pawn Код:
stock BanName(name[],reason[],admin[])
{
    new string[200];
    if(!IsBannedName(name))
    {
        new day, month, year, seconds, minutes, hours;
        gettime(hours,minutes,seconds);
        getdate(year,month,day);
        format(string, sizeof(string), "INSERT INTO BanNames (`Name`,`BanAdmin`,`BanReason`,`BanSeconds`,`BanMinutes`,`BanHours`,`BanDay`,`BanMonth`,`BanYear`) VALUE ('%s','%s','%s','%d','%d','%d','%d','%d','%d')",name,admin,reason,seconds,minutes,hours,day,month,year);
        mysql_query(string);
    }
    return true;
}
Here you go.Database name BanNames shouldn't be in ''.
That doesn't matter. It will work if it is or isn't, won't cause an error.