[eluser]Daburn[/eluser]
Hi Guys
I'm trying to become acquainted with CodeIgniter but now facing a problem with the returns of my DB query. I want to give all the values with no content the value "keine Angaben". Because else, the table cells with no content won't be draw.
My Model:
Code:
function list_stocks() {
$query = $this->db->query('SELECT * FROM stocks');
foreach ($query->result() as $value) {
if (strlen($value) == 0) $value = "keine Angaben";
}
return $query;
}
My Controller:
Code:
$this->load->model('Home_model','', TRUE);
$data['query'] = $this->Home_model->list_stocks();
$this->load->view('loader', $data);
Obviously, $query returns an object, but I'm not sure how to realise it else without addressing each result separately with:
Code:
if ($row->name == "") $row->name = " "
if ($row->price == "") $row->price = " "
Thanks a lot,
Daburn