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 5 of 5
  1. #1
    Regular Coder
    Join Date
    Dec 2009
    Posts
    173
    Thanks
    24
    Thanked 1 Time in 1 Post

    need to make more collumns with php

    hi guys i'd glad with someone help me to figure out how to output another collumn on my code well this is the code thanks!
    PHP Code:
    <?php   
    $uploaddir 
    'txt/';
    $uploadfile $uploaddir basename($_FILES['teext']['name']);



    echo 
    '<pre>';
    if (
    move_uploaded_file($_FILES['teext']['tmp_name'], $uploadfile)) {
        echo 
    "<h2>UPADO DE BOOOUA, o arquivo ta na pasta txt!\n</h2>";
    } else {
        echo 
    "<h2>Tem algum erro no arquivo TXT aí doido!\n</h2>";
    }
    //echo 'Info pra DEBUG:';
    //print_r($_FILES);
    print "</pre>";

    $arquivo $uploadfile;
    //$arquivo = $_FILES['teext']['tmp_name'];
    //$arquivo = $_POST['arquivo'];
    //$epi = file( 'txt/'.$arquivo );
    $epi file$arquivo );


    $a=1;
    echo 
    '<table width="75px" border="1px" style="border-collapse:collapse;">
      <tbody>
        <tr style="background-color: rgb(172, 201, 235);">
          <td><strong>MKV</strong></td>
        </tr>'
    ;
    foreach (
    $epi as $key => $value)   
    {   
        
    $epi[$key] = array();   
     
        
    $epi[$key] = explode(" "$value);   

           
        
    // The following will output: Episode 1   

        
    echo '<tr><td>'// start row
        
    echo '<a target="_blank" href='.$epi[$key][0].'>Episode '.$a++.'</a>';   
        echo 
    '</td></tr>'// end row
       
    }  

    echo 
    '</table>'// end table.. 
    ?>
    now how can i make another collumn for another txt file?
    outputing two collumns like MKV and RMVB
    thanks

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Is this a trick question? You just echo another td pair.
    PHP Code:
    echo '<table width="75px" border="1px" style="border-collapse:collapse;">
      <tbody>
        <tr style="background-color: rgb(172, 201, 235);">
          <td><strong>MKV</strong></td>
          <!-- -->
          <td>Something Else</td>
          <!-- -->
        </tr>'
    ;
    foreach (
    $epi as $key => $value)   
    {   
        
    $epi[$key] = array();   
     
        
    $epi[$key] = explode(" "$value);   

           
        
    // The following will output: Episode 1   

        
    echo '<tr>'// start row
        
    echo '<td><a target="_blank" href='.$epi[$key][0].'>Episode '.$a++.'</a></td>';   
        
    /**/
        
    echo '<td>more stuff</td>';   
        
    /**/
        
    echo '</tr>'// end row
       
    }  

    echo 
    '</table>'// end table.. 
    Are you a Help Vampire?

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Posts
    173
    Thanks
    24
    Thanked 1 Time in 1 Post
    hsuhashas sorry

    but i need to make another foreach links like
    PHP Code:
    echo '<table width="75px" border="1px" style="border-collapse:collapse;">
      <tbody>
        <tr style="background-color: rgb(172, 201, 235);">
          <td><strong>MKV</strong></td>
          <!-- -->
          <td>Something Else</td>
          <!-- -->
        </tr>'
    ;
    foreach (
    $epi as $key => $value)   
    {   
        
    $epi[$key] = array();   
     
        
    $epi[$key] = explode(" "$value);   

           
        
    // The following will output: Episode 1   

        
    echo '<tr>'// start row
        
    echo '<td><a target="_blank" href='.$epi[$key][0].'>Episode '.$a++.'</a></td>';   
        
    /**/
        
    echo '<td><a target="_blank" href='.$another txt epi[$key][0].'>Episode '.$a++.'</a></td>';   
        
    /**/
        
    echo '</tr>'// end row
       
    }  

    echo 
    '</table>'// end table.. 
    with that whre can i put another foreach?
    Last edited by sorlaker; 03-29-2010 at 05:01 PM.

  • #4
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    I don't understand what you're saying. I'm guessing that you mean you'd like to create table rows with cells populated from multiple arrays. There are several ways to do that. It would probably be easiest to use a new array that is a combination of the others so that the foreach loop is as simple as before.
    Are you a Help Vampire?

  • Users who have thanked tomws for this post:

    sorlaker (03-30-2010)

  • #5
    Regular Coder
    Join Date
    Dec 2009
    Posts
    173
    Thanks
    24
    Thanked 1 Time in 1 Post
    i got it thanks a lot!


  •  

    Posting Permissions

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