[eluser]abmcr[/eluser]
I have try to use a complex query : this sql work fine into the SQL tab of phpadmin... and not into CI.
Code:
$sql="CREATE TEMPORARY TABLE tmptable
SELECT id FROM bacheca AS A ORDER BY id DESC LIMIT 30;
DELETE bacheca FROM bacheca WHERE id NOT in (SELECT * FROM tmptable)";
$this->db->query($sql);
The error is
Code:
Error Number: 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 ';DELETE bacheca FROM bacheca WHERE id NOT in (SELECT * FROM tmptable)' at line 1
CREATE TEMPORARY TABLE tmptable SELECT id FROM bacheca AS A ORDER BY id DESC LIMIT 30;DELETE bacheca FROM bacheca WHERE id NOT in (SELECT * FROM tmptable)
[eluser]mintbridge[/eluser]
Im guessing that it will be because mysql_query() doesn't support multiple queries, and the query string should not end with (or have) a semicolon
[eluser]abmcr[/eluser]
No... i have insert all in one row, or i have try with regexp... but nothing ....it is not a CI problem, because the same sql with a normal SQL don't work.
Thank you