I’m building a site using CodeIgniter. I have lots of experience using SQL with PHP but having some trouble working through CodeIgniter.
I’m using the following code to set userdata to hold a logo from my database.
Currently I only have 1 logo and it works fine but I need to edit it to handle multiple logos.
$query3 = $this->db->query('SELECT file FROM ohes_flyer_logos');
$row3 = $query3->row();
$data = array( 'userlogo' => $row3->file );
$this->session->set_userdata($data);
Where the Logos are listed…
echo $this->session->userdata('userlogo');
How can I edit this to pass through a full list of logos, and echo them all out?
Calling
row()grabs only a single record. You probably want to useresult()orresult_array()and pass that to the view where you can loop through them. For example:Then in your view, you can do this: