SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    echo three arrays

    How to print three arrays values in a table

    $disc
    $qty
    $price


    PHP Code:
    echo '<table border=1 ><tr><td>';
            for(
    $i =0$i count($disc); $i++) { 
            echo 
    $disc[$i];
            echo 
    '</td><td>';
            echo 
    $qty[$i];
            echo 
    '</td><td>';
            echo 
    $price[$i];
            echo 
    '</td><tr>';
    }
            echo 
    '</table>'

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I sort out the prob....
    PHP Code:
            echo '<table border=1 ><tr>';
            for(
    $i =0$i count($disc); $i++) { 
            echo 
    '<td>';
            echo 
    $disc[$i];
            echo 
    '</td><td>';
            echo 
    $qty[$i];
            echo 
    '</td><td>';
            echo 
    $price[$i];
            echo 
    '</td><tr>';
            }
            echo 
    '</table>'

  3. #3
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    echo '<table>';
    for(
    $iIndex 0$iIndex count($aDesc); $iIndex++ )
    {
        
    printf(
            
    '<tr>
                <td>%s</td>
                <td>%s</td>
                <td>%s</td>
            </tr>'
    ,
            
    $aDesc[$iIndex],
            
    $aQuantity[$iIndex],
            
    $aPrice[$iIndex]
        );
    }
    echo 
    '</table>';
    ?>
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SilverBulletUK View Post
    PHP Code:
    <?php
    echo '<table>';
    for(
    $iIndex 0$iIndex count($aDesc); $iIndex++ )
    {
        
    printf(
            
    '<tr>
                <td>%s</td>
                <td>%s</td>
                <td>%s</td>
            </tr>'
    ,
            
    $aDesc[$iIndex],
            
    $aQuantity[$iIndex],
            
    $aPrice[$iIndex]
        );
    }
    echo 
    '</table>';
    ?>
    thanks brother for your quick & valuable reply...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •