MySQL Syntax Error
#1

I have this error in my console:

Код:
[MySQL] Error (0): Failed to exeute query. 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.
Also, I have found out that the wrong line should be this:

pawn Код:
getdate(year, month, day);
            gettime(hour, minute, second);
            PlayerInfo[playerid][pLogged]=1;
            GetPlayerName(playerid,pname,24);
            GetPlayerIp(playerid,ip,sizeof(ip));
            format(query, sizeof(query), "INSERT INTO users (name, password, money, bank, level, rank, faction, fwarn, fpunish, civilskin, ip, logged, regday, regmonth, regyear, reghour, regmin, regsec, loginday, loginmonth, loginyear, loginhour, loginmin, loginsec) VALUES('%s', '%s', 15000, 5000, 1, 0, 0, 0, 0, 24, '%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)", pname, escpass, ip, PlayerInfo[playerid][pLogged], day, month, year, hour, minute, second, day, month, year, hour, minute, second);
            mysql_query(query);
So, what is wrong with it? I verified for n times, still didn't get it. I am sure that this error is because I wasn't paying attention, but I can't figure out. Please help me.

P.S: This is located in OnPlayerDialogResponse, after Register Dialog. I have just aded some more data (from logged to loginsec) and now isn't working anymore.
Reply
#2

Try checking if your 'query' string variable isn't getting shorter for your query and check "INSERT INTO users (name,..." make it "INSERT INTO users(name,..." This might be causing too because there shouldn't be a space at there (or it might work, I never tried this way though).
Reply
#3

Print the query after executing:
pawn Код:
mysql_query(query);
print(query);
It is indeed a very large query and the size might not be enough to store the whole text. It's also recommended to use default values while creating a table so you won't need to add those values in the query (minus 8 fields and values).
Reply
#4

Quote:
Originally Posted by iZN
Посмотреть сообщение
Try checking if your 'query' string variable isn't getting shorter for your query and check "INSERT INTO users (name,..." make it "INSERT INTO users(name,..." This might be causing too because there shouldn't be a space at there (or it might work, I never tried this way though).
Ok. This is an awkward moment. I fought with this error for 3 hours, and I think the problem was the size (it was 350 and I modified into 500). So, thank you vey much. SOLVED!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)