mysql problem
#1

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?
Reply
#2

Enable the debug, and post the log.
Reply
#3

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.
Reply
#4

PHP код:
[21:55:33CMySQLHandler::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 ID1064You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1)
[
21:55:33] >> mysql_free_resultConnection handle
not working scotty
Reply
#5

Your query string size is too small. Increase it to 256 orsmth.
Reply
#6

wtf johnny, okay, tryin now

wuuw, thank you, worked
Reply
#7

Just an advice: you could use a default mysql function "UTC_TIMESTAMP( )" instead of the "%s" in the time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)