• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Active record delete query with join not working

#1
[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

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.