Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 02-07-2009
Member
 
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.
Reply With Quote
  #2  
Old 02-07-2009
Member
 
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.
Reply With Quote
  #3  
Old 02-07-2009
Member
 
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
Reply With Quote
  #4  
Old 02-07-2009
Member
 
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>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "need to show data in other html table for php"
Thread Thread Starter Forum Replies Last Post
How to Set table with Html Background? Aakarshan.d Software Development 3 26-11-2009 01:22 PM
Html table maker klite Windows Software 4 18-11-2009 08:32 PM
How to copy one table data into another table directly? ComPaCt Software Development 3 22-09-2009 03:54 PM
Convert Excel data to HTML Table Chalina Software Development 2 04-08-2009 11:21 PM
Insertion of clean Excel data into oracle table using html Valerian Software Development 3 13-06-2009 09:34 PM


All times are GMT +5.5. The time now is 02:41 AM.