MySQL doesn't execute a query
#1

Hey, code:
pawn Код:
new avardas[25];
                    GetPlayerName(playerid, avardas, 25);
                    new s[256];
                    format(s, sizeof(s), "[BAN] {B36666}%s {3EFFFF}uzblokavo {B36666}%s {3EFFFF}( %s )", avardas, vardas, prz);
                    SendClientMessageToAll(COLOR_CYAN, s); // everything till here went fine
                    new query[500];
                    mysql_format(1, query, sizeof(query), "UPDATE akauntai SET banned='1',przban='%s',banner='%e' WHERE vardas = '%e'", prz, avardas, vardas); // in mysql log I do see, that query is formatted successfully.
                    mysql_query(1,query); // but i don't see query executed successfully, only about formatting and deconstructor called.
                    new que[500];
                    mysql_format(1, que, sizeof(que), "INSERT INTO kickai (admin_name, kicked_name, prz, data, expiration, tipas) VALUES ('%e','%e','%s',NOW(),UNIX_TIMESTAMP()+2592000), '1'", avardas, vardas, prz);
                    mysql_query(1,que); // the same here
                    SetTimerEx("KickTimer", 100, false, "i", i); // further everything again works fine
                    break;
Anyone?
Reply
#2

Well I am also facing the same problem right now. Are you sure the connection handle is 1?
Reply
#3

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Well I am also facing the same problem right now. Are you sure the connection handle is 1?
Yeah, I always use this.
Reply
#4

I am new to MySQL. Are you sure it worked everytime when you use 1?
pawn Код:
new SQL = mysql_connect(blablabla);
Here SQL is the connection handle.
Reply
#5

Well yea, everytime. I had the same problem few days ago, that formatting is successful, but query can't be executed, but i FORGOT what I've done, because after what I've done, everything worked fine
I'll try that.
Reply
#6

That will happen when said query has something wrong with it, so you'd better investigate your query.

You're using the %e (floating-point scientific notation) specifier when I'm pretty sure you should be using %s.

Also make sure you're inserting all the necessary initial columns on INSERT.
Reply
#7

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
I am new to MySQL. Are you sure it worked everytime when you use 1?
pawn Код:
new SQL = mysql_connect(blablabla);
Here SQL is the connection handle.
Ok, now there are many errors with undefined symbol "sql" ((
Reply
#8

Quote:
Originally Posted by Deji
Посмотреть сообщение
That will happen when said query has something wrong with it, so you'd better investigate your query.

You're using the %e (floating-point scientific notation) specifier when I'm pretty sure you should be using %s.

Also make sure you're inserting all the necessary initial columns on INSERT.
Ok, now I tried using %s and I checked that I inserting all I need, but still shit happens
Reply
#9

Declare it as a global variable. I mean on top of your script.
Reply
#10

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Declare it as a global variable. I mean on top of your script.
Good, now one query is executed (first one), but second query still doesn't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)