CodeIgniter Forums
How can you run an mysqli 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: How can you run an mysqli query? (/showthread.php?tid=35467)



How can you run an mysqli query? - El Forum - 10-30-2010

[eluser]radu.v.valentin[/eluser]
Hello guys,

Does anyone have a clue how to run a mysqli query with CI. I did change the db driver in the config file, but I'm still unable to use multiple queries like

Code:
$sql = "SELECT * FROM c WHERE 1;
        DROP TABLE IF EXISTS c;"
$query = $this->db->query($sql);



Anyone has any clue how to do this using only CI, no additional libraries, because theoretically CI supports mysqli.

Thanks


How can you run an mysqli query? - El Forum - 10-30-2010

[eluser]WanWizard[/eluser]
CI doesn't support multiple SQL statements in one go.

Use
Code:
$sql = "SELECT * FROM c WHERE 1";
$query = $this->db->query($sql);

$sql = "DROP TABLE IF EXISTS c;";
$query = $this->db->query($sql);



How can you run an mysqli query? - El Forum - 10-30-2010

[eluser]radu.v.valentin[/eluser]
Hi WanWizard,

Thanks for the reply, that a bad news indeed, as I have a complex SQL script that I'll have to split. Well, to bad...

Regards,
R.