![]() |
Complex Sql don't work in $this->db->query() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Complex Sql don't work in $this->db->query() (/showthread.php?tid=11807) |
Complex Sql don't work in $this->db->query() - El Forum - 09-24-2008 [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 The error is Code: Error Number: 1064 Any suggestion? Thank you in advance.... ciao! Complex Sql don't work in $this->db->query() - El Forum - 09-24-2008 [eluser]richthegeek[/eluser] I get the impression CI removes the newline characters? Try running it with just mysql_query(); Also make sure you are running the right MySQL version? Complex Sql don't work in $this->db->query() - El Forum - 09-24-2008 [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 Paul Complex Sql don't work in $this->db->query() - El Forum - 09-24-2008 [eluser]richthegeek[/eluser] mysql_query DOES support multiple queries, when both the PHP and MySQL versions are on 5.x The semicolon does matter, and is in fact meant to be there - PHP just adds it on if it's not there. Complex Sql don't work in $this->db->query() - El Forum - 09-24-2008 [eluser]manilodisan[/eluser] Try: Code: $this->db->query(preg_replace('/[\n\r]+/','',$sql)); ...or try removing the new lines yourself ![]() Complex Sql don't work in $this->db->query() - El Forum - 09-24-2008 [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 Complex Sql don't work in $this->db->query() - El Forum - 09-24-2008 [eluser]manilodisan[/eluser] "DELETE bacheca FROM bacheca" Could this be an ambiguous naming?> |