0
function delete_ScormByIdPlataforma($id_platform)
    {
        $query = $this->db->query("delete from scormvars where scoinstanceid in
                (select scoinstanceid from dispatch where id_licencia in 
                (select id_licencia from licencias where id_plataforma = $id_platform))");
        // return true;
    }

This is my function in my model, the query is ok, but I don't know how to execute the query.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Arts
  • 53
  • 1
  • 8
  • This is how you execute a query in codeigniter, if your database is well configured in application/config/database. here $query is true or false if the query succeeded or failed. You can write : `function delete_ScormByIdPlataforma($id_platform) { return $this->db->query("delete from scormvars where scoinstanceid in (select scoinstanceid from dispatch where id_licencia in (select id_licencia from licencias where id_plataforma = $id_platform))"); }` – Xavier Doustaly Apr 27 '15 at 14:20
  • ok, now i am getting a error: Deletes are not allowed unless they contain a "where" or "like" clause. Filename: C:\wamp\www\WiccoCloud\system\database\DB_active_rec.php Line Number: 1567 – Arts Apr 27 '15 at 14:42
  • I think you should find what you need here : http://stackoverflow.com/questions/26589378/codeigniter-cannot-delete-rows-from-database-table-using-join-method – Xavier Doustaly Apr 27 '15 at 15:00

1 Answers1

0

You load the model class, then call the function:

$this->load->model('my_class');
$this->my_class->delete_ScormByIdPlataforma($id_platform);

Replacing my_class with the name of the class.

Richard Parnaby-King
  • 14,703
  • 11
  • 69
  • 129