mysql 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 problem (
/showthread.php?tid=283584)
mysql problem -
fordawinzz - 15.09.2011
hello, i'm havin' a prob with this:
pawn Код:
format( Query, sizeof Query, "INSERT INTO `bans` (`time`, `name`, `ip`, `reason`, `admin`, `banned`) VALUES ('%s', '%s', '%s', 'Wrong password', 'Server', 1)", mystring, escpname( playerid ), PIP );
mysql_query( Query );
mysql_free_result( );
it won't insert into the table.. why?
Re: mysql problem -
[MWR]Blood - 15.09.2011
Enable the debug, and post the log.
Re: mysql problem -
scottyishere - 15.09.2011
pawn Код:
format( Query, sizeof Query, "INSERT INTO `bans` (`time`, `name`, `ip`, `reason`, `admin`, `banned`) VALUES ('%s', '%s', '%s', 'Wrong password', 'Server', '1')", mystring, escpname( playerid ), PIP );
mysql_query( Query );
mysql_free_result( );
Try this, added the " ' " to the 1. If you put the quote-marks then put them to all data.
Re: mysql problem -
fordawinzz - 15.09.2011
PHP код:
[21:55:33] CMySQLHandler::Query(INSERT INTO `bans` (`time`, `name`, `ip`, `reason`, `admin`, `banned`) VALUES ('21:55:33 on 15/09/2011', 'lolomgg', '127.0.0.1') - 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:55:33] >> mysql_free_result( Connection handle: 1 )
not working scotty
Re: mysql problem -
Mr4rtur - 15.09.2011
Your query string size is too small. Increase it to 256 orsmth.
Re: mysql problem -
fordawinzz - 15.09.2011
wtf johnny, okay, tryin now
wuuw, thank you, worked
Re: mysql problem -
Mean - 15.09.2011
Just an advice: you could use a default mysql function "UTC_TIMESTAMP( )" instead of the "%s" in the time.