0
I am trying to delete photos from a view, however, I need to delete beyond the photo table the data from two more tables that are linked to this photo.
The code with the delete function is as follows:
function deleteImage($id)
{
$this->db->select('idImagem')->from('tbdimagem')->where('idImagem', $id);
$subQuery = $this->db->get_compiled_select();
$tabelas = array('tbdsubcategoria', 'tbdcategoria', 'tbdimagem');
$this->db->where('idImagem', $subQuery);
$this->db->delete($tabelas);
}
But it returns this when executing the function in the view:
EDIT 1
EDIT 2
Table Image
Table Category
Table Subcategory
I edited my post with a print of the result on this code you sent
– igorarmelin
Post also your table structure, for us to analyze... because it says there are no images in the table indicated.
– Sr. André Baill
I posted the tables. Just to be clear, in the table Tbdimagem the field idImage is primary key, and in the tables Tbdcategoria and Tbdsubcategoria the field idImage is foreign key.
– igorarmelin