snoopy1992 Posted June 2, 2010 Share Posted June 2, 2010 I am making a php program which can read variables from a txt file and puts them in a table. I have two variables working in the table (Name and Account Number)but the others just appear at the top of the page rather then in the table. What am i doing wrong i also need to make it so it will add the next lot of data underneath the first lot collected <?php print "<table>"; print "<tr>"; print "<th>Name</th><th>Account Number</td>Time and Date<th>Lengh of Visit<th/>Reason For Call<th>Cost of Extra Medication "; $file = fopen('data.txt', 'r'); // Open data.txt for reading from beginning while(!feof($file)) { // While not end of file $line = fgets($file); // Read a line from the file if($line) { $record = explode(",",$line); print "<tr><td>$record[0]</td><td>$record[1]</td></td>$record[2]</td>$record[3]</td>$record[4]< /td></</td>$record[5]</td>"; } } print "</table>"; fclose($file); // Close the file ?> Link to comment https://forums.phpfreaks.com/topic/203618-text-to-table/ Share on other sites More sharing options...
apsingh1981 Posted June 2, 2010 Share Posted June 2, 2010 I Think problem is with closing </tr> tag which is missing .... Link to comment https://forums.phpfreaks.com/topic/203618-text-to-table/#findComment-1066580 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.