Results 1 to 4 of 4

Thread: need to show data in other html table for php

  1. #1
    Join Date
    May 2008
    Posts
    255

    need to show data in other html table for php

    Hi,

    I have a form in php & the details get stored in a text file.
    I want these details to get stored & then to be displayed in another webpage in a table.
    I am not sure if I could do this in php.
    If you can help me out it will be great.
    Your suggestions are most welcome.

  2. #2
    Join Date
    Aug 2008
    Posts
    281

    Re: need to show data in other html table for php

    Try this:

    Code:
     <?
    
          $data=file_get_contents('filename.txt'); //get data from file
    
          $dat=explode("\r\n",$data); //split data at new lines
    
          echo '<table border=1 cellpadding=3 cellspacing=0>';
    
          foreach ($dat AS $val) { //loop
    
          echo '<tr><td>'.$val.'</td></tr>'; //display
    
          }
    
          echo '</table>';
    
          ?>
    I hope this is what you need.

  3. #3
    Join Date
    May 2008
    Posts
    41

    Re: need to show data in other html table for php

    I have a question regarding display of data in php table in corresponding table & respective columns & I am really dont have any idea if its possible for me.
    If you have any idea to display mysql data on php table please help[ me out with the code.
    Thanks in advance

  4. #4
    Join Date
    Oct 2008
    Posts
    35

    Re: need to show data in other html table for php

    Try this code:
    Code:
    <table border="2" width="75%" cellpadding="3" cellspacing="3">
    <tr>
    <td align="center">signature</td>
    <td align="center">dst_ip</td>
    <td align="center">src_ip</td>
    <td align="center">date</td>
    </tr>
    <?php
    
    <?
    $host = "localhost";
    $user = "#*$!x";
    $pass = "#*$!xx";
    $dbname = "xxxxx";
    
    $connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
    mysql_select_db($dbname);
    //Query that is being run
    $query= "select * from signature where sig_name= '" . $_POST['IP'] . "'";
    //this will try to spit out the previous sql query
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    //this is a line break before the spit output
    
    while ($line = mysql_fetch_row($result) )
    {
    echo '<tr>';
    echo '<td align="center">'.$line[0].'</td>';
    echo '<td align="center">'.$line[1].'</td>';
    echo '<td align="center">'.$line[2].'</td>';
    echo '<td align="center">'.$line[3].'</td>';
    echo '</tr>';
    }
    
    ?>
    </table>

Similar Threads

  1. How to Set table with Html Background?
    By Aakarshan.d in forum Software Development
    Replies: 3
    Last Post: 26-11-2009, 01:22 PM
  2. Html table maker
    By klite in forum Windows Software
    Replies: 4
    Last Post: 18-11-2009, 08:32 PM
  3. How to copy one table data into another table directly?
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 22-09-2009, 03:54 PM
  4. Convert Excel data to HTML Table
    By Chalina in forum Software Development
    Replies: 2
    Last Post: 04-08-2009, 11:21 PM
  5. Insertion of clean Excel data into oracle table using html
    By Valerian in forum Software Development
    Replies: 3
    Last Post: 13-06-2009, 09:34 PM

Tags for this Thread

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
  •  
Page generated in 1,713,308,406.67354 seconds with 17 queries