MySQLi delete in multiply tables |
Hi.
In this code PHP Code: $tables = array('tasks', 'task_time', 'task_favorites', 'task_subscribers'); I've got error Code: Deletes are not allowed unless they contain a "where" or "like" clause. What's wrong? CI version 3.0.1
I think it's clear enough. CI developers decided it's unsafe to use db->delete without where clause so they forbidden it. Better to use db->truncate anyway
(05-16-2015, 01:38 AM)gadelat Wrote: I think it's clear enough. CI developers decided it's unsafe to use db->delete without where clause so they forbidden it. Better to use db->truncate anywayDid you look at his code? He has a "where" statement, and his code is almost identical to the example in the userguide, so it should work fine. (05-16-2015, 04:01 PM)CroNiX Wrote:(05-16-2015, 01:38 AM)gadelat Wrote: I think it's clear enough. CI developers decided it's unsafe to use db->delete without where clause so they forbidden it. Better to use db->truncate anywayDid you look at his code? He has a "where" statement, and his code is almost identical to the example in the userguide, so it should work fine. Yeah! Is it bug?
Ah sorry, somehow I did not see that. Well, this code definitely works. Maybe your installation is somehow messed up. Try to replace system folder again, if it does not help, you need to track the problem yourself.
(05-17-2015, 05:45 AM)xmod Wrote: Where I can write about this bug to developers? In the issues for the github repo https://github.com/bcit-ci/CodeIgniter/issues
It's not a bug, you have to pass the WHERE clause to delete() when you want to delete from multiple tables ...
@Narf maybe the userguide needs updating then because what he had is exactly what it shows:
http://www.codeigniter.com/user_guide/da...eting-data Code: $tables = array('table1', 'table2', 'table3'); |
Welcome Guest, Not a member yet? Register Sign In |