[eluser]TWP Marketing[/eluser]
Code:
function members_area()
{
$username = $this->session->userdata('username');
$queryG = $this->db->query("SELECT name FROM games WHERE author = '$username' ");
if ($queryG->num_rows() > 0)
{
$data['games'] = array();
foreach ($queryG->result_array() as $row)
{
$row['name'];// <-- this doesn`t do anything
}
}
$data['games']=$row; //<-- this is outside the loop and will only receive the LAST $row data
$this->load->view('logged_in_area', $data);
}
Try this instead:
Code:
function members_area()
{
$username = $this->session->userdata('username');
$queryG = $this->db->query("SELECT name FROM games WHERE author = '$username' ");
if ($queryG->num_rows() > 0)
{
$data['games'] = array();
$i = 1; // initialize counter
foreach ($queryG->result_array() as $row)
{
$i++;
$data['games'][$i] = $row;
}
}
$this->load->view('logged_in_area', $data);
Now loop through the $games array in your view and it should contain more than one entry
[edit] ok your way is simpler than mine...