I have a table "books". In my "books" table, I have two foreign keys "product_id" and "cat_id". I want to apply updating the "books" where two foreign keys also changing. Unfortunately, I only success updating the "product_id".
Here is my update query:
UPDATE books SET product_id='$product', cat_id='$category'......WHERE books_id='$books_id';
And here is my controller:
public function updateBook()
{
.....
$id = $this->input->post('books_id');
$product = $this->input->post('product_name');
$category = $this->input->post('category_name');
$this->my_model->updatItem($id, $product, $category, bla..bla..bla);
.....
}
Once again, for those two foreign keys, I only success updating the "product" and I wondered what was wrong?
@life4learn - I would recommend you that if you are using codeigniter you must use it active record for queries. There are predefined properties which make your job quicker and easier. And check what you are getting in POST for categories which you are updating.