[eluser]inktri[/eluser]
sql table: users
user controller, within index() function, :
Code:
$data['query'] = $this->db->get('users');
$this->load->view('user_view', $data);
user view:
Quote:<?php foreach($query->result() as $user): ?>
<pre><?php $user->username ?></pre>
<?php endforeach; ?>
yields nothing
but
Code:
<?php foreach($query->result() as $user): ?>
<pre><?php var_dump($user) ?></pre>
<?php endforeach; ?>
shows
Code:
object(stdClass)#13 (8) {
["id"]=>
string(1) "1"
["username"]=>
string(6) "inktri"
["password"]=>
string(32) "eba3cbb6f3b8265ee302e2339fc83dbc"
["birthday"]=>
string(10) "2006-05-00"
["gender"]=>
string(1) "m"
["city_id"]=>
string(1) "1"
["pic"]=>
string(1) "1"
}
Why can't I access the username with $user->username?
thanks for the help