[eluser]_Smilie_[/eluser]
Hi,
So I'm trying to parse an Array to my view file, and that array contains another array.
Controller:
Code:
function view(){
$form_id = mysql_real_escape_string($this->uri->segment(3));
$row = $this->db
->where('quest_form =', $form_id) //don't really need the =, that is the default
->get('form_question')
->row();
$data['question_list'] = array();
foreach($row as $row2){
array_push($data['question_list'], $this->convertQuest($row2->quest_type));
//$data['question_list'] array($this->convertQuest($row2->quest_type));
}
$this->load->view('global/header');
$this->load->view('global/userinfo');
$this->load->view('form_view', $data);
}
function convertQuest($quest_type){
if($quest_type == 1){
return '
<div class="mws-form-row">
<label>Title</label>
<div class="mws-form-item large">
<input type="text" name="host_title" class="mws-textinput required" />
</div>
</div>';
}
}
My view:
Code:
<?php foreach ($question_list as $question):
echo $question;
endforeach;?>
Alright, so this produces a total of 3 errors:
Code:
Message: Trying to get property of non-object
Filename: controllers/form.php
Line Number: 19
Line 19:
array_push($data['question_list'], $this->convertQuest($row2->quest_type));
Dunno why it produces 3, as I only have one entry in my database.. Also I don't know why this error occurs at all ^^