<?php
include('../headertop.php');
include('../db.php');

date_default_timezone_set('Asia/Kolkata');

$start = $_POST['start'];
$correct2 = $_POST['correct2'];
//print_r($correct2);

foreach($correct2 as $correct)
{
if(empty($correct['work_type']))
$worktype = 'To be corrected';
else
{
$worktype = $correct['work_type'];
$datedb = date("Y-m-d", strtotime($correct['date']));
$q[] = "update expenses set work_type='$worktype', date='".$datedb."', comments='corrected' where id='".$correct['id']."'";
}
/*
foreach($correct as $k=>$v)
{
echo $k. ' - '.$v.'<br>';
}
echo '<p>';
*/
}

//print_r($q);

mysqli_autocommit($dbcon, false);

foreach($q as $query)
{
mysqli_query($dbcon,$query) or die(mysqli_error($dbcon));
}

mysqli_commit($dbcon);
//$start_old = $start;
//$start = $start + 20;

$sm = "Corrections made ";
echo '<meta http-equiv="refresh" content="0;URL=correctexpenses.php?sm='.$sm.'">';

