• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Only getting first letter of each row :/

#1
[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!

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

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

Nice Spot!

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.