error while executing query
#1

My query doesn't update and I don't know why...

This is the errors.log of mysql:
Код:
[plugins/mysql] error #1064 while executing query "UPDATE `players` SET `ip` = 255.255.255.255, `level` = 1, `cash` = 1500, `skin` = 55, `health` = 100.000000, `armour` = 0.000000, `x` = 1961.375488, `y` = 1345.643921, `z` = 15.374607, `angle` = 294.196442, `interior` = 0, `vw` = 0 WHERE `id` = 1 LIMIT 1": You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.255.255, `level` = 1, `cash` = 1500, `skin` = 55, `health` = 100.000000, `armou' at line 1
and this is the line of the script:
pawn Код:
new query[500];
    mysql_format(Database, query, sizeof query, "UPDATE `players` SET `ip` = %s, `level` = %d, `cash` = %d, `skin` = %d, `health` = %f, `armour` = %f, `x` = %f, `y` = %f, `z` = %f, `angle` = %f, `interior` = %d, `vw` = %d WHERE `id` = %d LIMIT 1", pInfo[playerid][IP], pInfo[playerid][Level], pInfo[playerid][Cash], pInfo[playerid][Skin], pInfo[playerid][Health], pInfo[playerid][Armour], pInfo[playerid][X_Pos], pInfo[playerid][Y_Pos], pInfo[playerid][Z_Pos], pInfo[playerid][A_Pos], GetPlayerInterior(playerid), GetPlayerVirtualWorld(playerid), pInfo[playerid][ID]);
    mysql_tquery(Database, query);
Reply
#2

Because in some way you use ` ` and in some ways you don't example:

Try smth like that on each.

Код:
`skin` = '%d'
Reply
#3

Quote:
Originally Posted by Hunud
Посмотреть сообщение
Because in some way you use ` ` and in some ways you don't example:

Try smth like that on each.

Код:
`skin` = '%d'
It worked, love you mate!
Reply
#4

You need to use ' on a string, yes. Also, use '%e' specifier instead of '%s' when you use mysql_format. It escape your query from injections and other stuffs like that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)