Welcome Guest, Not a member yet? Register   Sign In
Something I would like to know about model/controller/view
#1

[eluser]Unknown[/eluser]
Hi all

I would like to know how CodeIgniter work, I have look at the guide I didn't find a solution.

Code:
// standard model query
   $query = $this->db->get('data');
   return $query->result();

This work pretty well if you use a foreach in a view for more than one result.. but if the result only return one row the foreach is useless in the view in this situation.

my problem if how to get my data in my row in my view?

thanks
#2

[eluser]rogierb[/eluser]
use
Code:
return $query->row();
or
Code:
return $query->row_array()
to get only one row, just like the almighty user guide says.
#3

[eluser]überfuzz[/eluser]
If you ever feel unsure of a variable/array and its contents use this:
Code:
echo "<pre>";
print_r($variable);
echo "</pre>";

//If that's not enough information use var_dump()




Theme © iAndrew 2016 - Forum software by © MyBB