[eluser]pyrokinesis[/eluser]
Hi guys,
I am trying to change the value retrieved from a model in my controller.
The table in my db is:
Code:
+----------+--------------+--------------------+
| staff_id | name | email_address |
+----------+--------------+--------------------+
| 1 | William Hill | [email protected] |
| 2 | John Carlson | [email protected] |
| 3 | Hugh Bishop | [email protected] |
+----------+--------------+--------------------+
Model:
Code:
function get_data() {
$query =
"SELECT
staff_id AS 'Staff ID',
name AS 'Name',
email_address AS 'Email Address',
FROM staff
";
return $this->db->query($query);
}
Controller:
Code:
function show_data() {
$this->output->enable_profiler(TRUE);
$this->load->model('test_model');
$result = $this->test_model->get_data();
foreach ($result->result() as $row) {
$row->{'Email Address'} = str_replace('gmail', 'yahoo', $row->{'Email Address'});
}
echo '<pre>';
print_r($result);
echo '</pre>';
//Values are changed in $result here
echo $this->table->generate($result);
//Replaced values are not put into the table
}
The values seem to be changed but the updated values are not replaced in the table though...
Does anyone have any ideas? :ohh:
Thanks.