Niroj Prajapati Niroj Prajapati -4 years ago 60
PHP Question

Update not working while updating

While updating database column about 22000 rows at a time only 6000 data are updating. It doesn't shows any errors!

here's my code



for($i=0;$i<=$total/500;$i++)
{
for($j=0;$j<=500;$j++)
{

$patient_id[$i][$j] = $rows[$i * 500 +$j]['patient_id'];
$total_appointment[$i][$j] = $rows[$i*500+$j]
['total_appointments'];


$this->db->set('no_of_appointment',$total_appointment[$i][$j]);
$this->db->where('patient_id',$patient_id[$i][$j]);

$this->db->update('tbl_patients');


}

}

Answer Source

Try to set session timeout in and increase query execution time above your loop

set_time_limit( 0 );
ini_set('mysql.connect_timeout','7200');
ini_set('max_execution_time', '0');

Maybe it solve your error..

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download