Jump to content

[SOLVED] PHP Table


ChompGator

Recommended Posts

Hey,

 

My table now is working fine, the only  problem is:

There is the table - with the headings - "flight" "departs" "arrives" "time" "status"

Now when the information is displayed under the table headings its like the table appears

<here>    on the page but the information for under the headings appears

            <over here>

 

The information isn't lining up with the table headings - here is the script - any suggestions? - thanks -

 

<?php
$con = mysql_connect("localhost","admin","******") or die('Could not connect: ' . mysql_error());
mysql_select_db("login", $con);

$result = mysql_query("SELECT * FROM flight");

echo "<h2><table class=\"outline\" cellSpacing=\"0\" cellPadding=\"0\" width=\"185%\" border=\"0\">
<tr class=\"font_title_light\" cellspacing=\"2\">
<td class=\"style15\" style=\"width: 9%\"><strong>Flight</strong></td>
<td width=\"15%\" class=\"style14\">
<strong><span class=\"style14\"><span class=\"style13\">Departs</span></span></strong><span class=\"style13\"></a></td>
<td style=\"width: 9%\" class=\"style15\">
<strong><span class=\"style14\">Arrives</span></strong></a></td>
<td width=\"15%\" class=\"style16\"><strong>Time</strong></td>
<td width=\"15%\" class=\"style14\"></span><strong><span class=\"style13\">Status</span></strong></td>
</tr>
<tr class=\"S_box\">
<td colSpan=\"4\" class=\"style13\">
</tr>
<tr class=\"style12\" style=\"PADDING-BOTTOM: 5px; PADDING-TOP: 5px\">
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 22%;\" vAlign=\"top\">
<br>
</td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px\" vAlign=\"top\"> </td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 15%;\" vAlign=\"top\">
 </td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px\" vAlign=\"top\"> </td>
<td class=\"style13\"> </td>
</tr>		</h2>
	<p> </p>
	</td>
</tr>
</table>
"; while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['pid'] . "</td>";
  echo "<td>" . $row['departure'] . "<td>";
  echo "<td>" . $row['arrival'] . "</td>";
  echo "<td>" . $row['time'] . "</td>";
  echo "<td>" . $row['status'] . "</td>";
  echo "</tr>";
  }
echo "</table>";mysql_close($con);
?>

Link to comment
https://forums.phpfreaks.com/topic/82687-solved-php-table/
Share on other sites

Here is the new script, it is still not working - the table displays but the information doesn't display under the appropriate headings.

I added a echo "</tr>" and an

              echo "</td>"  at the end of the script

the information is being displayed and it has moved over to the left, which is good, but the information still isn't under the appropriate table headings :(

 

- Just thought Id add this for informational purposes if you have any tips anyone.

 

<?php
$con = mysql_connect("mysql105.mysite4now.com","aiim","k7YuHeFv") or die('Could not connect: ' . mysql_error());
mysql_select_db("login", $con);

$result = mysql_query("SELECT * FROM flight");

echo "<h2><table class=\"outline\" cellSpacing=\"0\" cellPadding=\"0\" width=\"185%\" border=\"0\">
<tr class=\"font_title_light\" cellspacing=\"2\">
<td class=\"style15\" style=\"width: 9%\"><strong>Flight</strong></td>
<td width=\"15%\" class=\"style14\">
<strong><span class=\"style14\"><span class=\"style13\">Departs</span></span></strong><span class=\"style13\"></a></td>
<td style=\"width: 9%\" class=\"style15\">
<strong><span class=\"style14\">Arrives</span></strong></a></td>
<td width=\"15%\" class=\"style16\"><strong>Time</strong></td>
<td width=\"15%\" class=\"style14\"></span><strong><span class=\"style13\">Status</span></strong></td>
</tr>
<tr class=\"S_box\">
<td colSpan=\"4\" class=\"style13\">
</tr>
<tr class=\"style12\" style=\"PADDING-BOTTOM: 5px; PADDING-TOP: 5px\">
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 22%;\" vAlign=\"top\">
<br>
</td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px\" vAlign=\"top\"> </td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 15%;\" vAlign=\"top\">
 </td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px\" vAlign=\"top\"> </td>
<td class=\"style13\"> </td>
</tr>		</h2>
	<p> </p>
	</td>
		</tr>
			</table>
";  while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['pid'] . "</td>";
  echo "<td>" . $row['departure'] . "<td>";
  echo "<td>" . $row['arrival'] . "</td>";
  echo "<td>" . $row['time'] . "</td>";
  echo "<td>" . $row['status'] . "</td>";
  echo "</tr>";
  echo "</td>";
  }
echo "</table>";mysql_close($con);
?>

Link to comment
https://forums.phpfreaks.com/topic/82687-solved-php-table/#findComment-420564
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.