I have an array which I am getting from my database. For instance:
$db_record = $this->search_model->search_Employee();
foreach ($db_record as $db_data) {
echo $db_data->phone_number;
}
In above example I am able to fetch the record without any issue, but I want to add other data in $db_data
afterwards.
foreach ($db_record as $db_data) {
echo $db_data->phone_number;
$db_data[]['new_value']='prashant';
}
but $db_data[]['new_value']='prashant';
throwing below error
Cannot use object of type stdClass as array in
It will great if someone can help me as struggeling more than 5 hours.