mysql error...
#1

Hi, i got a mysql error with saving logs system...

Quote:

[21:06:22] errorid: 1064 | error: 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

code:

Quote:

format(Uzklausa, sizeof(Uzklausa), "INSERT INTO `logai` (data,vardas,logas) VALUES ('%s', '%s', '%s')", logudata, zVardas, logas);
mysql_query(Uzklausa);

Reply
#2

The message you posted is cut so we don't know where in the code the error is near at.

What will also help is to print the query, like after the mysql_query function:
pawn Код:
print(Uzklausa);
copy it from the server log and post it with the whole error message.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
The message you posted is cut so we don't know where in the code the error is near at.

What will also help is to print the query, like after the mysql_query function:
pawn Код:
print(Uzklausa);
copy it from the server log and post it with the whole error message.
Quote:

[16:06:34] CMySQLHandler::Query(INSERT INTO `logai` (data,vardas,logas) VALUES ('2015-4-24 16:6:34', 'Harry_Jones', '[gRPG.pwn]: Sistema iљmetė Harry_Jones uћ ) - 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 ''[gRPG.pwn]: Sistema iљmetė Harry_Jones uћ' at line 1)

code:

Quote:

public OnPlayerUpdate(playerid)
{
new string[128], zVardas[MAX_PLAYER_NAME], data[6], logudata[50], Uzklausa[128], logas[300];
new ginklas = GetPlayerWeapon(playerid);
GetPlayerName(playerid, zVardas, sizeof(zVardas));
getdate(data[0], data[1], data[2]);
gettime(data[3], data[4], data[5]);
if(ginklas == 16 || ginklas == 18 || ginklas == 26 || ginklas == 28 || ginklas == 32 || ginklas == 33 || ginklas == 35 || ginklas == 36 || ginklas == 37 || ginklas == 38 || ginklas == 39 || ginklas == 40 || ginklas == 44 || ginklas == 45)
{
format(string, sizeof(string), "[ANTICHEAT]: {FF8040}%s buvo iљmestas uћ neleistinus ginklus! (Ginklo ID: %i)", zVardas, ginklas);
SendClientMessageToAll(0xFF8080FF, string);
SetTimerEx("KickEx", 100, false, "i", playerid);
format(logudata, sizeof(logudata), "%0.2d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d", data[0], data[1], data[2], data[3], data[4], data[5]);
format(logas, sizeof(logas), "[gRPG.pwn]: Sistema iљmetė %s uћ neleistinus ginklus! (Ginklo ID: %i)", zVardas, ginklas);
format(Uzklausa, sizeof(Uzklausa), "INSERT INTO `logai` (data,vardas,logas) VALUES ('%s', '%s', '%s')", logudata, zVardas, logas);
printf(logas);
mysql_query(Uzklausa);
return 1;
}
return 1;
}

Reply
#4

Change the size of "Uzklausa" from 128 to a higher one such as 150. 126 characters + NULL is the output until "už" so the string does not have enough size to store the whole message.
Reply
#5

data vardas logas
2015-4-24 17:0:40
Dwayne_Walsh
[gRPG.pwn]: Sistema iрmetл Dwayne_Walsh uю neleistinus ginklus! (Ginklo ID: 33)

fixed! thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)