SA-MP Forums Archive
Problem with INSERT query - 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: Problem with INSERT query (/showthread.php?tid=584434)



Problem with INSERT query - AA9 - 04.08.2015

I'm trying to INSERT value to MySQL table i get strange error. Can't seem to fix it.
Код:
 [ERROR] CMySQLQuery::Execute[] - (error #1054) Unknown column 'e' in 'field list
Код:
format(oldname, 24, pInfo[targetid][Name]);
format(pInfo[targetid][Name], 24, inputtext);

format(string, sizeof(string), "INSERT INTO namechanges(PlayerSQL, OldName, NewName) VALUES(%d, %e, %e)", pInfo[targetid][ID], pInfo[targetid][Name], oldname);
mysql_tquery(SQL, string);



Re: Problem with INSERT query - MarvinPWN - 04.08.2015

PHP код:
format(stringsizeof(string), "INSERT INTO namechanges (PlayerSQL, OldName, NewName) VALUES (%d, '%e', '%e')"pInfo[targetid][ID], pInfo[targetid][Name], oldname); 
When it doesn't work then you can try this:
PHP код:
mysql_format(SQL,stringsizeof(string), "INSERT INTO namechanges (PlayerSQL, OldName, NewName) VALUES (%d, '%e', '%e')"pInfo[targetid][ID], pInfo[targetid][Name], oldname); 



Re: Problem with INSERT query - AA9 - 04.08.2015

Now it shows
Код:
[ERROR] CMySQLQuery::Execute[] - (error #1054) Unknown column 'NAME_I_INSERTED' in 'field list'



Re: Problem with INSERT query - AA9 - 05.08.2015

Anyone?


Re: Problem with INSERT query - Evocator - 05.08.2015

INSERT INTO `namechanges` (`PlayerSQL`, `OldName`, `NewName`) VALUES ('%d', '%e', '%e')


Re: Problem with INSERT query - AA9 - 05.08.2015

Something very strange with it. Now i got new error, tried to increase query size but nothing.
Код:
[ERROR] CMySQLQuery::Execute[] - (error #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 ''namechanges'('PlayerSQL', 'OldName', 'NewName') VALUES('8', 'Glen_Johnson','Dra' at line 1



Re: Problem with INSERT query - AA9 - 05.08.2015

Fixed it with solution below. Never had used quotes in mysql, but with R39 it seems im forced to do so.
Код:
mysql_format(SQL, string, sizeof(string), "INSERT INTO namechanges(PlayerSQL, OldName, NewName) VALUES('%d', '%e','%e')", pInfo[targetid][ID], pInfo[targetid][Name], oldname);