• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
formatting query results

#1
[eluser]gafro[/eluser]
Hey Guys and Gals,

Looking for some info with the results received from a query.

overview example:

DB (table name = items)

id name
1 titleone
2 titletwo
3 titlethree
4 titlefour

Controller

$this->db-get('items');

view

<ul>
&lt;?php foreach($items-result() as $item):?&gt;

<li>&lt;?=$item->titleon?&gt;</li>
&lt;?php endforeach;?&gt;
</ul>


What I'd like to do is add a class to the li on every 3rd row.

<ul>
<li>itemone</li>
<li>itemtwo</li>
<li class="classname">itemthree</li>
<li>itemfour</li>
</ul>

I'm not sure how to get access to the keys from the array the active record has returned.

Can anyone shed some light or point me in the right direction.

Cheers all
Gafroninja


Messages In This Thread
formatting query results - by El Forum - 10-13-2008, 03:15 AM
formatting query results - by El Forum - 10-13-2008, 04:05 AM
formatting query results - by El Forum - 10-13-2008, 04:09 AM
formatting query results - by El Forum - 10-13-2008, 04:16 AM
formatting query results - by El Forum - 10-13-2008, 06:44 AM
formatting query results - by El Forum - 10-13-2008, 06:55 AM
formatting query results - by El Forum - 10-13-2008, 07:24 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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