I have query
INSERT INTO subscriptions ( client_id, name, group_id, type )
SELECT clients.id, 'Индивидуал', 0, 1 FROM clients WHERE clients.individual=1;
ALTER TABLE clients DROP COLUMN clients.individual;
ALTER TABLE finance_operations ADD COLUMN sub_id INT NOT NULL DEFAULT 0;
which works fine in Mysql Workbench. But if I use it in codeIgniter code:
$this->db->simple_query($query);
I get 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 'ALTER TABLE clients DROP COLUMN clients.individual; ALTER TABLE' at line 4
PDO can not run more than one question one time; This code is right:
$array = [ "query1", "query2", "query3" ];
foreach($array as $query)
$this->db->simple_query($query);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.