[eluser]Unknown[/eluser]
Hi,
I'm completely new to codeigniter but trying to get it to work.
Currently I'm trying to pass results from a table into a dropdown menu. And I've got to the point where it is passing the results, but only 1 (not the whole array)
in my controller I have this
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'];
}
}
$data['games']=$row;
$this->load->view('logged_in_area', $data);
}
in my view I got a simple dropbox like this
Code:
----html---
<?php
echo form_open('site/gamebuilder');
echo form_dropdown('game', $games);
echo form_submit('submit', 'Load Game');
?>
----html---
Can anybody tell me where I went wrong in this and how to fix it?
oh and if you're wondering it displays only the last row resulting from the query
Thx a lot in advance