MySQL problem
#1

pawn Код:
format(Query, sizeof(Query), "INSERT INTO Players (Username, Password, Score, IP) VALUES('%s', SHA1('%s'), 0, '%s'", pName, password, IP);
Outcome:

Quote:

[19:08:49] CMySQLHandler::Query(INSERT INTO Players (Username, Password, Score, IP) VALUES('test', SHA1('password'), 0, 'my.ip.here') - 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)

I also tried `Players` but same error.
Reply
#2

You are missing a ) from the end I suppose.

Also, I suggest you use a default value for the Score field so you don't have to specify it in your INSERT query.
Reply
#3

Oh right. Was missing a ), thank you.

So if I set a default value for Score, I'll just leave it blank in the INSERT? Or do I have to add it to the INSERT at all?
Reply
#4

If you have a default value for it, there's no need to include Score in your INSERT query at all. No field name, no value for it.
Reply
#5

Okay, thanks alot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)