What i am trying to do:
Try to Clone Data (Update) from Table "Payment History" to "Payment" , But the problem right now is that in Payment History Table there is "PaymentHistory_ID" column , how do I ignore it ?
Payment Table
Payment_ID
Payment_Amount
Payment_Method
Payment_Remark
Payment History Table
Payment_ID
PaymentHistory_ID
Payment_Amount
Payment_Method
Payment_Remark
Both have the same column and same data type
My Code: Controller
public function updateHistory($Payment_ID){
$query = $this->db->where('Payment_ID', $Payment_ID)->get('PaymentHistory');
foreach ($query->result() as $row) {
$this->db->where('Payment_ID', $row->Payment_ID)->update('PaymentHistory', $row); // To update existing record
//$this->db->insert('Payment',$row); // To insert new record
}
}
Based on the question that I have provided Codeigniter Clone Data from table and update it , the codes works , but not the new problem that I am facing.
Note: New to CodeIgniter