Welcome Guest, Not a member yet? Register   Sign In
Retrieving information from arrays
#1

[eluser]Robb__[/eluser]
I'm having trouble getting this to work.

Fist, I save information to theese arrays;
Code:
$data['Image'][$i] = $resultrow2[$i] ->Image; // {../Images/test.jpg, ../Images/test2.jpg, ../Images/test.jpg)
$data['Name'][$i] = $resultrow3[$i] ->productName; //{"one", "two", "three"]
$data['Price'][$i] = $resultrow4[$i] ->Price; // {10,20,30)
$data['Desc'][$i] = $resultrow5[$i] ->Description; // {"first one, second, third"}

Code:
$this->load->view('index',$data);

Then in my index.php I want to retrieve this information, but it doesn't work?

Code:
<?php for ($i=0; $i< $5; $i++): ?>
<img src="&lt;?=${"Image$i"};?&gt;" onclick="showImage(&lt;?=${"Name$i"};?&gt;,&lt;?=${"Price$i"};?&gt;,'&lt;?=${"Desc$i"};?&gt;'); alt=""/&gt;</a>
&lt;?php endfor; ?&gt;


Messages In This Thread
Retrieving information from arrays - by El Forum - 10-21-2007, 12:56 PM
Retrieving information from arrays - by El Forum - 10-21-2007, 02:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB