MySQL - INSERT INTO error - 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: MySQL - INSERT INTO error (
/showthread.php?tid=417038)
MySQL - INSERT INTO error -
Rdx - 19.02.2013
Код HTML:
CMySQLHandler::Query(INSERT INTO `game_logs` (`uid`,`owner`,`charid`,`adminid`,`kara`,`powod`) VALUES ('1','2', '102', '2', '9', 'test') - 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 '' at line 1)
Code:
Код HTML:
stock Punishment(type,playerid,admin,reason[],time)
{
new query[256];
new uid = GetFreeSQLUID("game_logs", "uid");
format(query, sizeof(query), "INSERT INTO `game_logs` (`uid`,`owner`,`charid`,`adminid`,`type`,`reason`) VALUES ('%d','%d', '%d', '%d', '%d', '%s'",
uid,PlayerInfo[playerid][pOwnerUID], PlayerInfo[playerid][pUID], PlayerInfo[admin][pOwnerUID], type, reason);
mysql_query(query);
What is wrong?
Re: MySQL - INSERT INTO error -
FUNExtreme - 19.02.2013
Run the query in phpmyadmin. It has better error handling.
Re: MySQL - INSERT INTO error -
Rdx - 19.02.2013
Quote:
Originally Posted by FUNExtreme
Run the query in phpmyadmin. It has better error handling.
|
It's working in phpmyadmin.
Re: MySQL - INSERT INTO error -
Vince - 19.02.2013
I doubt that. You're missing a closing bracket at the very end of your query. The log doesn't make that very clear, but if you count the amount of opening brackets and the amount of closing brackets then you'll notice a mismatch.
Re: MySQL - INSERT INTO error -
Rdx - 19.02.2013
Quote:
Originally Posted by Vince
I doubt that. You're missing a closing bracket at the very end of your query. The log doesn't make that very clear, but if you count the amount of opening brackets and the amount of closing brackets then you'll notice a mismatch.
|
Thanks man, problem solved.