Welcome Guest, Not a member yet? Register   Sign In
[solved] print_r ok, but echo in no way. What is the right term?
#1

[eluser]Jan_1[/eluser]
Tryed to get data in every way. Getting mad... Some help please? Thank you!

print_r($wg_rechte);
Quote:Array ( [0] => stdClass Object ( [edit_daten] => 1 [edit_regeln] => 0 ) )
echo $wg_rechte['edit_daten'];
Quote:Message: Trying to get property of non-object
echo $wg_rechte->edit_daten;
Quote:Message: Undefined variable: edit_daten

Model:
Code:
function get_wg_rechte()
  {
  $this->db->select('edit_daten', FALSE);
  $this->db->select('edit_regeln');
  $this->db->where('user_id', $this->db_session->userdata('id'));
  $this->db->where('wg_id', '34');
  $this->db->order_by('von', 'desc');
  $this->db->limit(1);
  $query = $this->db->get('wg_member');
        if ($query->num_rows()>0)
          { $data = $query->result();}
  return $data;
  }
Controller:
Code:
$this->load->model('FreakAuth_light/standard_model');
$data['wg_rechte']= $this->standard_model->get_wg_rechte();
$this->load->vars($data);
$this->load->view($this->_container, $dataform);
View:
#2

[eluser]xwero[/eluser]
the object is in an array so you have to do
Code:
echo $wg_rechte[0]->edit_daten;
To prevent this use row instead of result.
#3

[eluser]Jan_1[/eluser]
Thank you, xwero!!
I've tried so, but it did'nt work (also... - need to work it out).
Regards!
#4

[eluser]TheFuzzy0ne[/eluser]
What's in your view file? From what I can see, your model returns an unset variable if there are no result rows, when really it should return FALSE or something along those lines.




Theme © iAndrew 2016 - Forum software by © MyBB