title: Error when retrieving and updating data from database in Codeigniter
body: <p>In my application controller, I have a method <code>transaction_reimburse()</code> that receives ids as <code>POST</code> string values. The method's function is to get all transactions that match the ids from the database, and update them accordingly.</p>
  
  <p><strong>Controller method:</strong></p>
  
  <pre><code>public function transaction_reimburse() {
  
      $reimburse = array('reimburse' =&gt; 1);
      $transactions = $this-&gt;Transaction_model-&gt;get_these_ids($this-&gt;input-&gt;post('ids'));
      $this-&gt;Transaction_model-&gt;reimburse_these($transactions, $reimburse);
  
  }
  </code></pre>
  
  <p><strong>Model method:</strong></p>
  
  <pre><code>function get_these_ids($ids) {
  
      $this-&gt;db-&gt;select('tbl_user.name as uname, tbl_transactions.participant_id as pid, tbl_transactions.card_number as card_no, tbl_transactions.group as ugroup, tbl_toilet.name as utoilet, tbl_transactions.amount_paid as u_amount, tbl_transactions.toilet_price as t_price, tbl_transactions.reimburse_amount as r_amount, tbl_transactions.details as u_details');
      $this-&gt;db-&gt;from('tbl_transactions');
      $this-&gt;db-&gt;join('tbl_user', 'tbl_user.participant_id = tbl_transactions.participant_id', 'left');
      $this-&gt;db-&gt;join('tbl_toilet', 'tbl_toilet.toilet_code = tbl_transactions.toilet_code', 'left');
      $this-&gt;db-&gt;where("tbl_transactions.id IN (". $ids .")");
      return $this-&gt;db-&gt;get();
  
  }
  </code></pre>
  
  <p><strong>Model method:</strong></p>
  
  <pre><code>function reimburse_these($transactions, $reimburse) {
  
      $this-&gt;db-&gt;select('tbl_user.name as uname, tbl_transactions.participant_id as pid, tbl_transactions.card_number as card_no, tbl_transactions.group as ugroup, tbl_toilet.name as utoilet, tbl_transactions.amount_paid as u_amount, tbl_transactions.toilet_price as t_price, tbl_transactions.reimburse_amount as r_amount, tbl_transactions.details as u_details');
      $this-&gt;db-&gt;from('tbl_transactions');
      $this-&gt;db-&gt;join('tbl_user', 'tbl_user.participant_id = tbl_transactions.participant_id', 'left');
      $this-&gt;db-&gt;join('tbl_toilet', 'tbl_toilet.toilet_code = tbl_transactions.toilet_code', 'left');
      $this-&gt;db-&gt;where("tbl_transactions.id IN (". $transactions .")");
      $this-&gt;db-&gt;update($this-&gt;tbl_transaction, $reimburse);
  
  }
  </code></pre>
  
  <p><strong>However, I am getting the following error:</strong></p>
  
  <pre><code>A PHP Error was encountered    
  Severity: 4096
  Message: Object of class CI_DB_mysql_result could not be converted to string
  Filename: models/transaction_model.php
  Line Number: 450
  
  A Database Error Occurred
  Error Number: 1064
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
  UPDATE `tbl_transactions` SET `reimburse` = 1 WHERE `tbl_transactions`.`id` IN ()
  Filename: C:\xampp\htdocs\ipa\system\database\DB_driver.php
  Line Number: 330
  </code></pre>
  
  <p>What I need to know is why do I get these errors?</p>