CodeIgniter Forums
Active record delete query with join not working - 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: Active record delete query with join not working (/showthread.php?tid=61155)



Active record delete query with join not working - El Forum - 10-02-2014

[eluser]Andy UK[/eluser]
I'm trying to do a vary basic delete of rows from a many to many table with some WHERE filters. One of the columns i need to include in the filter is a category column from another table. Here is my code:
Code:
function deleteFeatures($property_id)
{
$this->db->join('property_tags', 'property_tags.id = property_tags_join.tag_id')
   ->where_in('category',array(1,2))
   ->where('property_id', $property_id)
   ->delete('property_tags_join');
}

As you can see I want to delete tags that are of category one and two and also have the necessary property id. The category field is not in the join table, but in the tags table where we define the actual tags available.... ID, Tag, Category.

For some reason i keep getting the database error of Unknown column 'category' in 'where clause'.

Am I missing something obvious? Thanks


Active record delete query with join not working - El Forum - 10-03-2014

[eluser]InsiteFX[/eluser]
Try using quotes around your array('1', '2')