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



MySQL Query Problem - shaPP - 14.11.2012

Hi, I just converted my script to MySQL and i have a little problem with an query.

Error Code:
Код:
[15:46:52] 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 'Name`, `IP`, `Time`, `Reason`, `Date`, 
`Admin`, `Expire`, `Code`} VALUES ('sHapp' at line 1, OnQueryFinish, INSERT INTO `bans_ip (`Name`, 
`IP`, `Time`, `Reason`, `Date`, `Admin`, `Expire`, `Code`} VALUES ('sHapp3z0r', '192.168.0.100', '2', 
'Reclama', '14/11/2012 la 15:46:52', 'Server/Anticheat', '2012/11/16 la 15:46:52', '2012,11,16,15,46,52'), 1
Code:
Код:
format(query, sizeof(query), "INSERT INTO `"#MYSQL_BANSIPTABLE" (`Name`, `IP`, `Time`, `Reason`, 
`Date`, `Admin`, \
	`Expire`, `Code`} VALUES ('%s', '%s', '%d', '%s', '%s', '%s', '%s', '%s')", GetName(playerid), 
PlayerIP(playerid), time, reason2, string, admin, expiredate, expire);
	mysql_query(query, -1, -1, 1);
Witch can be the problem ?


Re: MySQL Query Problem - wups - 14.11.2012

Quote:

`"#MYSQL_BANSIPTABLE"

here is your problem.


Re: MySQL Query Problem - shaPP - 14.11.2012

Код:
#define MYSQL_BANSIPTABLE		"bans_ip"
If were there error it would say somethink like Table wasn't find ...


Re: MySQL Query Problem - wups - 14.11.2012

Quote:
Originally Posted by shaPP
Посмотреть сообщение
Код:
#define MYSQL_BANSIPTABLE		"bans_ip"
If were there error it would say somethink like Table wasn't find ...
Look at my post again.


Re: MySQL Query Problem - shaPP - 14.11.2012

Oh, missed one "`" :"> Trying it now. Thanks!