Reputation: 3
While updating database column about 22000 rows at a time only 6000 data are updating. It doesn't shows any errors!
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');
}
}
Upvotes: 0
Views: 42
Reputation: 11
I think you need to increase mysql.connect_timeout
. Please check the following link for better grasp over it.
You can increase mysql.connect_timeout
like the following.
mysql.connect_timeout = 14400
. Also increase default_socket_timeout = 14400
.
ini_set('mysql.connect_timeout', 14400);
ini_set('default_socket_timeout', 14400);
For reference, you can check the following link:
How long does a PHP MySQL database connection remain active?
Upvotes: 0
Reputation: 1539
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..
Upvotes: 1