Help, Insert and select in the same query (MySQL) - 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: Help, Insert and select in the same query (MySQL) (
/showthread.php?tid=657142)
Help, Insert and select in the same query (MySQL) -
Paulthaz - 01.08.2018
How do I insert something into the database and select the same query? I tried to do this but there is the following:
"SELECT max (` conce_id`) as maximum FROM `concecars` '" If you have an error in your SQL syntax, check the manual that corresponds to your MySQL server for the right syntax to use near'
the query is this:
"SELECT max (` conce_id`) as maximum FROM FROM 'INSERT INTO `concecars` (` conce_dono`, `conce_pos`,` conce_color`) VALUES (' Yoshi ', '555.302002, 555.302002, 555.302002', '1, 1'); `concecars`;"
in the database works, but within the game mode does not work. Can someone help me?
Re: Help, Insert and select in the same query (MySQL) -
Banditul18 - 01.08.2018
So you want to extract the last inserted id? If yes then check out
https://sampwiki.blast.hk/wiki/MySQL#cache_insert_id
If you use this in callback called byt a insert query you get hte last inserted id