1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Data Loop Issue with HTML UL Tags :(

Discussion in 'PHP' started by vidjin, Sep 23, 2011.

  1. #1
    Hi,

    Can someone give an example how the following task can be achieved smartly?

    I have this Database Table with 2 fields
    1. Brand_ID
    2. Brand_Name


    SQL = SELECT Brand_ID, Brand_Name from brands limit 0,12;

    and I have to loop through it and place the values in the following HTML code

    
    
    <ul class="w105 fltL mr10">            <li><a href="{BRAND_ID HERE}">{BRAND_NAME HERE}</a></li>            <li><a href="#"> Motorolla </a></li>            <li><a href="#"> Blackbarry </a></li>            <li><a href="#"> HTC </a></li>        </ul>        <ul class="w105 fltL mr10">            <li><a href="#"> Apple</a></li>            <li><a href="#"> LG </a></li>            <li><a href="#"> Sony-Ericsson </a></li>            <li><a href="#"> Samsung </a></li>        </ul>        <ul class="w105 fltL mr10">            <li><a href="#"> China Mobile </a></li>            <li><a href="#"> I-mate </a></li>            <li><a href="#"> O2 </a></li>            <li><a href="#"> Trend </a></li>        </ul>
    HTML:
    The challenge with this html code is that we have to loop between the UL tags 4 times and then move to the Next UL Tag to again loop 4 times until all 12 values are placed.

    Any Ideas?
     
    vidjin, Sep 23, 2011 IP
  2. gvre

    gvre Member

    Messages:
    35
    Likes Received:
    6
    Best Answers:
    3
    Trophy Points:
    33
    #2
    Something like the following will do the job.

     
    gvre, Sep 24, 2011 IP