[Looking for] PHP table script

Discussion in 'PHP' started by webblab, Apr 8, 2008.

  1. #1
    Hello Guys,
    Could you suggest me a free table script. So I could easily add data to rows.

    It should be something like that one


    Thanks in advance.
     
    webblab, Apr 8, 2008 IP
  2. Louis11

    Louis11 Active Member

    Messages:
    783
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    70
    #2
    
    <?
    #####################################
    # Louis's Super Simple Table Script #
    #####################################
    
    // connect to database FIRST
    // ..
    
    // get rows from db
    $sql = mysql_query("select * from table_name") or die(mysql_error());
    ?>
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    
    <?
    // get all rows in database
    while($row = mysql_fetch_assoc($sql))
    {
        $val1 = htmlspecialchars($row['row_one']);
        $val2 = htmlspecialchars($row['val_two']);
        $val3 = htmlspecialchars($row['val_three']);
    
        ?>
        <tr>
          <td><? print $val1; ?></td>
          <td><? print $val2; ?></td>
          <td><? print $val3; ?></td>
        </tr>
        <?
    }
    ?>
    </table>
    PHP:
    Well obviously it's not a complete CMS. However the basic concept is there (it should run; I haven't tested it . . .). You will need a database that is populated with the correct information, then feel free to use this code and modify it to your needs.

    Cheers,
    Louis
     
    Louis11, Apr 8, 2008 IP