Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2004
    Posts
    38
    Thanks
    0
    Thanked 2 Times in 2 Posts

    duplicating a row

    I have a column in my table that holds a variable number. and I want to display the query results for that whole row as many times as the number that is stored in that column for that row.

    Meaning if row has 4 for the column it will echo/print that row 4 times. How can I do this??

  • #2
    Regular Coder
    Join Date
    May 2002
    Location
    Virginia, USA
    Posts
    621
    Thanks
    0
    Thanked 6 Times in 6 Posts
    Depends on formatting of course, but...

    PHP Code:

    ...

    while (
    $row mysql_fetch_assoc($result)) {

        for (
    $x 0$x <= $row["column_name_of_variable_number"]; $x++ ) {
            
    /* print out the results, ie: echo $row["column3"];   */
        
    }
    }

    .... 

    ... indicate assumed code.

    HTH,
    -Celt


  •  

    Posting Permissions

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