I'm trying to run this PHP script to get some data from a web service, it works perfectly fine 50~120 times, but then it throws this exception. This is my controller:
/* $dataArray = Array(
* "Column1" => "value1",
* "Column2" => "value2",
* and so on...);
*/
foreach ($dataArray as $row => $value)
{
// $value[$PrimaryKey] >>> where condition
// $PrimaryKey >>> name of the column
// $Table >>> table name
if($this->m_myModel->verifyRow($value[$PrimaryKey], $PrimaryKey, $Table))
{
$newArray[] = $value;
unset($dataArray[$row]);
}// if
}// foreach
And my Model:
function verifyRow($where, $select, $table)
{
//$this->db->query("SELECT $select FROM $table WHERE $select = $where LIMIT 1");
$this->db->select($select)
->from($table)
->where($select, $where)
->limit(1);
$query = $this->db->get();
if(isset($query->result()[0])) // This is where the error occurs
return true;
else
return false;
}// function verifyRow
I forgot that I changed the $db['default']['db_debug'] in config files to FALSE, so I was not getting any DB error, then I printed $this->db->_error_message(); and got this: MySQL server has gone away