I try to get a variable working on my next page.
In controller.php I have the following:
$buttons .= '<a href="'.base_url('klant/profiel/'.$value['id']).'" class="btn btn-default"><i class="fa fa-address-book"></i></a>';
And the part that is about the profiel view in controller I have this:
public function profiel($id = null)
{
$data = $this->klant_model->getKlantData($id);
echo json_encode($data);
$this->render_template('klant/profiel', $this->data);
}
In my model I have this:
public function getKlantData($id = null)
{
if($id) {
$sql = "SELECT * FROM klant WHERE id = ?";
$query = $this->db->query($sql, array($id));
return $query->row_array();
}
$sql = "SELECT * FROM klant";
$query = $this->db->query($sql);
return $query->result_array();
}
And in my view I have this:
<?php echo $data['bedrijf']; ?>
I just want to echo out each colum of the row I have selected in the beginning.
This error I get:
Message: Undefined variable: value
My Answer:
Rate this post
5 of 5 based on 5034 votesComments