mysql error -
Onfroi - 21.12.2014
Since I'm not good at finding little detail errors, can anyone tell why do I keep getting this?
Quote:
[16:04:57] CMySQLHandler::Query(INSERT INTO `Accounts` (Username,Password,IP,Money,Score,Kills,Deaths,Ran k,Achievements,AdminLvl,milKills,swatKills,mapDeat hs) VALUES('Onfroi','hashed password) - 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 ''hashed password' at line 1)
|
I understand the error, but I can't find anything wrong with the syntax
pawn Код:
format(Query,sizeof(Query),"INSERT INTO `Accounts` (Username,Password,IP,Money,Score,Kills,Deaths,Rank,Achievements,AdminLvl,milKills,swatKills,mapDeaths) VALUES('%s','%s','%s','0','0','0','0','1','0','0','0','0','0')",pName(playerid),buffer,GetPlayerIP(playerid));
Thanks in advance.
Re: mysql error -
Ox1gEN - 21.12.2014
This is supposed to solve the issue.
pawn Код:
format(Query,sizeof(Query),"INSERT INTO `Accounts` (`Username`,`Password`,`IP`,`Money`,`Score`,`Kills`,`Deaths`,`Rank`,`Achievements`,`AdminLvl`,`milKills`,`swatKills`,`mapDeaths`) VALUES('%s','%s','%s',%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",pName(playerid),buffer,GetPlayerIP(playerid), 0, 0, 0, 0, 1, 0, 0, 0, 0, 0);
Re: mysql error -
Onfroi - 21.12.2014
Quote:
Originally Posted by Ox1gEN
This is supposed to solve the issue.
pawn Код:
format(Query,sizeof(Query),"INSERT INTO `Accounts` (`Username`,`Password`,`IP`,`Money`,`Score`,`Kills`,`Deaths`,`Rank`,`Achievements`,`AdminLvl`,`milKills`,`swatKills`,`mapDeaths`) VALUES('%s','%s','%s',%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",pName(playerid),buffer,GetPlayerIP(playerid), 0, 0, 0, 0, 1, 0, 0, 0, 0, 0);
|
Didn't work, still get the same error.
Re: mysql error -
Ox1gEN - 21.12.2014
Weird.
It should work.
Make sure you have your variables set to what you use in the query, for example if you use '%s' for Username make sure that you actually set a string to Username.
And make sure that in the database it's the same.
I have also had that problem like yours but I just use the code like the above one I gave you and just change it if anything like that occurs.
Here's a code out of my script to show you that how I wrote it is actually (Supposed to be) working:
pawn Код:
mysql_format(dbHandle, query, sizeof(query), "INSERT INTO `dealerships` (`DsLocX`, `DsLocY`, `DsLocZ`, `DsIcon`) VALUES (%f, %f, %f, %d)", x, y, z, 1239);
mysql_tquery(dbHandle, query);
You see? I've bassicly did the same thing, therefore I am telling you to re-check on the stuff surrounding it the query and not the query itself.
(Btw, I am talking about the part where I wrote 1239 and not entered a variable of some sort)
Re: mysql error -
Onfroi - 22.12.2014
Turns out Whirlpool was causing the error, still don't know why, because a while back it was working correctly. Maybe the string is too long or something? [129]
Re: mysql error -
Ox1gEN - 22.12.2014
Quote:
Originally Posted by Onfroi
Turns out Whirlpool was causing the error, still don't know why, because a while back it was working correctly. Maybe the string is too long or something? [129]
|
Mhm-.. Weird.
And not sure about that one, try asking the one who created Whirlpool.
Re: mysql error -
LiamM - 22.12.2014
Here is a few things that may fix it:
1. Your variable called 'Query' will require more characters / space assigned to it as it may have run out of memory to process the rest.
2. In your error I noticed one field has a space between it, is that maybe the problem? Is it supposed to have a space? I'll put it in bold below.
[16:04:57] CMySQLHandler::Query(INSERT INTO `Accounts` (Username,Password,IP,Money,Score,Kills,Deaths,
Ran k,Achievements,AdminLvl,milKills,swatKills,
mapDeat hs)
3. How many characters do you have assigned for your 'Password' field within the MySQL database?
Re: mysql error -
Onfroi - 22.12.2014
Quote:
Originally Posted by LiamM
Here is a few things that may fix it:
1. Your variable called 'Query' will require more characters / space assigned to it as it may have run out of memory to process the rest.
2. In your error I noticed one field has a space between it, is that maybe the problem? Is it supposed to have a space? I'll put it in bold below.
[16:04:57] CMySQLHandler::Query(INSERT INTO `Accounts` (Username,Password,IP,Money,Score,Kills,Deaths,Ran k,Achievements,AdminLvl,milKills,swatKills,mapDeat hs)
3. How many characters do you have assigned for your 'Password' field within the MySQL database?
|
That was it, the Query string was too short, thanks!