SA-MP Forums Archive
Query problem. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Query problem. (/showthread.php?tid=247818)



Query problem. - Rokzlive - 10.04.2011

Wth is wrong with this query? I give a cookie to whoever tell me

pawn Код:
format(query, sizeof(query), "INSERT INTO `ownedcars` (`Model`, `Color1`, `Color2`, `Price`, `Owner`, `PosX`, `PosY`, `PosZ`, `PosA`, `Plate`, `bPrice`) VALUES ('%i', -1, -1, 0, '%s', '%f', '%f', '%f', '%f', '%s', '%d')", cModel, pname, X, Y, Z, A, pname, cPrice);
    mysql_query(query);



Re: Query problem. - iJumbo - 10.04.2011

What error you get?


Re: Query problem. - Alby Fire - 10.04.2011

pawn Код:
mysql_debug(1);
format(query, sizeof(query), "INSERT INTO `ownedcars` (`Model`, `Color1`, `Color2`, `Price`, `Owner`, `PosX`, `PosY`, `PosZ`, `PosA`, `Plate`, `bPrice`) VALUES ('%i', -1, -1, 0, '%s', '%f', '%f', '%f', '%f', '%s', '%d')", cModel, pname, X, Y, Z, A, pname, cPrice);
mysql_query(query);
mysql_debug(0);
Put this, then goto the mysql_log (in your server's folder) and post here what has been logged


Re: Query problem. - Rokzlive - 10.04.2011

[Sun Apr 10 16:42:14 2011] Error (0): Failed to exeute query. Duplicate entry '0' for key 1.


Re: Query problem. - Rokzlive - 10.04.2011

Dude, you know as much as i do. All that that query is supposed to do is enter data into a mysql database. I dont have any clue whats going on with it.


Re: Query problem. - Vince - 10.04.2011

You need to set auto increment for a key ..
http://dev.mysql.com/doc/refman/5.1/...increment.html


Re: Query problem. - Rokzlive - 10.04.2011

Owww, opps, lol. Im tired so im not thinking. Lol. Ok thx i got it.