MySQL ban 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 ban help (
/showthread.php?tid=585633)
MySQL ban help -
Gr1Fax - 15.08.2015
Hi my friends, how to fix: (error #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 '(ban_timestamp + (ban_time * 60), 'unixepoch')) as banExpired, strftime('%d-%m-%' at line 1
what is the problem? Before banning player
Then after banning player:
11:36:22 CMySQLQuery::Execute ERROR (error #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 '(ban_timestamp + (ban_time * 60), 'unixepoch')) as banExpired, strftime('%d-%m-%' at line 1
11:36:22 cache_get_row_count WARNING no active cache
11:36:29 CMySQLQuery::Execute ERROR (error #2006) MySQL server has gone away
11:36:45 CMySQLQuery::Execute ERROR (error #1305) FUNCTION ojk.strftime does not exist
Re: MySQL ban help -
Dziugsas - 15.08.2015
First of all show the code lines if you want help.
Re: MySQL ban help -
Gr1Fax - 15.08.2015
Code:
Код:
format(gQuery, MAX_QUERY_LENGTH, "SELECT user_banned, ban_reason, ban_time, (ban_timestamp + (ban_time * 60) - strftime('%%s', 'now')) as banTimeLeft, strftime('%%d-%%m-%%Y %%H:%%M', datetime(ban_timestamp + (ban_time * 60), 'unixepoch')) as banExpired, strftime('%%d-%%m-%%Y %%H:%%M', datetime(ban_timestamp, 'unixepoch')) as bannedFrom, user_banner FROM `bans` WHERE user_banned_ip = '%s' OR user_banned = '%s' AND (banTimeLeft > 0 OR ban_time = 0);", getIP(playerid), GetName(playerid));
Re: MySQL ban help -
Variable™ - 15.08.2015
put the code between [code [/code
Re: MySQL ban help -
Gr1Fax - 16.08.2015
Код:
format(gQuery, MAX_QUERY_LENGTH, "SELECT user_banned, ban_reason, ban_time, (ban_timestamp + (ban_time * 60) - strftime('%%s', 'now')) as banTimeLeft, strftime('%%d-%%m-%%Y %%H:%%M', datetime(ban_timestamp + (ban_time * 60), 'unixepoch')) as banExpired, strftime('%%d-%%m-%%Y %%H:%%M', datetime(ban_timestamp, 'unixepoch')) as bannedFrom, user_banner FROM `bans` WHERE user_banned_ip = '%s' OR user_banned = '%s' AND (banTimeLeft > 0 OR ban_time = 0);", getIP(playerid), GetName(playerid));
Theres code