CodeIgniter Forums

Full Version: Only getting first letter of each row :/
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]kevinprince[/eluser]
Hi,

Im having a small problem with some code I've written, for some reason when I do my foreach loop in the view, im only getting the first letter displaying of each row, and applying the foreach to the columns not the rows.

All very odd, heres the code extract:

Code:
$get_licences = $this->db->query("SELECT *  FROM `vk_licences` WHERE `gid` = '" . $gid . "'");
This is the the go get from DB bit

Code:
$member = array(
'licence' => $get_licences->row_array()
)
I add the row_array() into my view array

Code:
</tr>
&lt;?php foreach($licence as $item):?&gt;
<tr class="odd">
<td>&lt;?php echo $item['wkgb']; ?&gt;</td>
<td>&lt;?php echo $item['expiry']; ?&gt;</td>
</tr>
&lt;?php endforeach ?&gt;
The bit in the loop

Any help appreciated!

El Forum

[eluser]Phil Sturgeon[/eluser]
Use result_array() instead. You cant foreach a 1 dimensional array.

El Forum

[eluser]kevinprince[/eluser]
Wow, I just made a idiot out of myself!

Nice Spot!

El Forum

[eluser]Phil Sturgeon[/eluser]
Happens to us all. Run out of mountain dew/red bull/whiskey/etc? Wouldnt be the first time :p