SA-MP Forums Archive
Query not working.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Query not working.. (/showthread.php?tid=435303)



Query not working.. - BlackRaven - 06.05.2013

Why this query is not working?

pawn Код:
command(test, playerid, params[])
{
    new query[100];
    format(query, sizeof(query),"UPDATE vehicles SET lock = %d WHERE id = %d",0,61);
    mysql_query(query);
    return 1;
}
EDIT: I'm using BlueG plugin the version is R6.

EDIT: Error from Debug file:
Quote:

[13:51:49] CMySQLHandler::Query(UPDATE vehicles SET lock = 0 WHERE id = 61) - 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 'lock = 0 WHERE id = 61' at line 1)




Re: Query not working.. - Yashas - 06.05.2013

There must be no "lock" comumn in your database.


Re: Query not working.. - BlackRaven - 06.05.2013

Quote:

id

model

color1

color2

x

y

z

a

name

lock

owner

spawned

destroyed

licenses

engine

type

Mysql structure


Re: Query not working.. - Yashas - 06.05.2013

Sometimes error happen when you put a MySQL Specifier in place of an identifier.

Try this

"UPDATE 'vehicles' SET 'lock' = '%d'WHERE id = '%d'"


Re: Query not working.. - BlackRaven - 06.05.2013

Quote:
Originally Posted by Yashas
Посмотреть сообщение
Sometimes error happen when you put a MySQL Specifier in place of an identifier.

Try this

"UPDATE 'vehicles' SET 'lock' = '%d'WHERE id = '%d'"
I did that now and didnt work again.


Re: Query not working.. - Lionel - 06.05.2013

try this
pawn Код:
command(test, playerid, params[])
{
    new query[100];
    new ids;
    ids=61;
    format(query, sizeof(query), "UPDATE `vehicles` SET lock = '0' WHERE id = '%d'",ids);
    mysql_query(query);

    return 1;
}
Or this if 1 does not work
pawn Код:
command(test, playerid, params[])
{
     mysql_query("UPDATE `vehicles` SET lock = '0' WHERE id = '61' ");
    return 1;
}



Re: Query not working.. - BlackRaven - 06.05.2013

Quote:
Originally Posted by Lionel
Посмотреть сообщение
try this
pawn Код:
command(test, playerid, params[])
{
    new query[100];
    new ids;
    ids=61;
    format(query, sizeof(query), "UPDATE `vehicles` SET lock = '0' WHERE id = '%d'",ids);
    mysql_query(query);
    return 1;
}
Not working.


Re: Query not working.. - Lionel - 06.05.2013

and this?
pawn Код:
command(test, playerid, params[])
{
     mysql_query("UPDATE `vehicles` SET lock = '0' WHERE `id` = '61' ");
    return 1;
}



Re: Query not working.. - BlackRaven - 06.05.2013

Quote:
Originally Posted by Lionel
Посмотреть сообщение
and this?
pawn Код:
command(test, playerid, params[])
{
     mysql_query("UPDATE `vehicles` SET lock = '0' WHERE id = '61' ");
    return 1;
}
Doesnt work fuck


Re: Query not working.. - Lionel - 06.05.2013

pawn Код:
command(test, playerid, params[])
{
     mysql_query("UPDATE `vehicles` SET lock = '0' WHERE `id` = '61' ");
    return 1;
}
and this? if this does not work i give up ^^