nish darsh
asked on
A PHP Error was encountered Severity: Notice Message: Undefined variable: persona
I am getting the above error and I am really not sure where I am going wrong. I am using Codeigniter framework. Following is my code:
Controller:
public function createtask()
{
$this->load->model('person a_model');
$data['persona']=$this->pe rsona_mode l->view();
$this->load->view('createt ask_view', $data);
}
Model:
function view()
{
$this->db->select('*');
$this->db->from('persona') ;
$query = $this->db->get();
if($query->num_rows()>0){
return $query->result();
}else{
return $query->result();
}
}
view:
<table class="table">
<thead>
<tr>
<th>Persona ID </th>
<th>Firstname </th>
<th>Lastname</th>
</tr>
</thead>
<tbody>
<?php
foreach($persona as $row)
{
?>
<tr>
<td><?php echo $row->personaid; ?></td>
<td><?php echo $row->firstname; ?></td>
<td><?php echo $row->lastname; ?></td>
<?php }
?>
</tbody>
Kindly help I have been looking into this since a long time.
Controller:
public function createtask()
{
$this->load->model('person
$data['persona']=$this->pe
$this->load->view('createt
}
Model:
function view()
{
$this->db->select('*');
$this->db->from('persona')
$query = $this->db->get();
if($query->num_rows()>0){
return $query->result();
}else{
return $query->result();
}
}
view:
<table class="table">
<thead>
<tr>
<th>Persona ID </th>
<th>Firstname </th>
<th>Lastname</th>
</tr>
</thead>
<tbody>
<?php
foreach($persona as $row)
{
?>
<tr>
<td><?php echo $row->personaid; ?></td>
<td><?php echo $row->firstname; ?></td>
<td><?php echo $row->lastname; ?></td>
<?php }
?>
</tbody>
Kindly help I have been looking into this since a long time.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thank you very much.. both you comments helped me retireve the values from database and display it..