• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Update multiple table from CSV in Cpdeigniter

#4
[eluser]Tim Brownlaw[/eluser]
Code:
function update_monthly_due($md_work_id, $mf_amount)
{
$sql = "UPDATE monthly_due set md_due = md_due - " . $mf_amount . ", md_paid = md_paid - " . $mf_amount . " WHERE md_work_id = " . $md_work_id;
$this->db->query($sql);
}

Your md_work_id is obviously a string and not an integer... So it needs to be wrapped in quotes ''... So you would then have...

Code:
function update_monthly_due($md_work_id, $mf_amount)
{
$sql = "UPDATE monthly_due set md_due = md_due - " . $mf_amount . ", md_paid = md_paid - " . $mf_amount . " WHERE md_work_id = '{$md_work_id}'";
$this->db->query($sql);
}

The {} is a little trick for helping to separate variables in a Double Quoted String. You could try it on the others... but see if that works first.


Messages In This Thread
Update multiple table from CSV in Cpdeigniter - by El Forum - 08-21-2014, 02:01 AM
Update multiple table from CSV in Cpdeigniter - by El Forum - 08-21-2014, 06:51 AM
Update multiple table from CSV in Cpdeigniter - by El Forum - 08-22-2014, 11:04 PM
Update multiple table from CSV in Cpdeigniter - by El Forum - 08-23-2014, 01:45 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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