0

I have to update multiple records.

I call this method to update multiple records.

How to update all unique_id records in one query?

public function updateLease($data)
{
    $sql = "UPDATE tbl_lease SET company = '".$data['company']."', total_price = '".$data['total_price_paid']."', price_per_hecters = '".$data['price_per_hactare']."' WHERE record_date = '".$data['record_date']."' AND lease_code = '".$data['lease_code']."' AND region = '".$data['region']."' AND site_id = '".$data['site_id']."'";

    $result = mysql_query($sql);

    if ($result) {
        return true;
    } else {
        return false;
    }
}
Danila Ganchar
  • 10,266
  • 13
  • 49
  • 75
Kishan Kikani
  • 41
  • 1
  • 12

0 Answers0