Jump to content

[SOLVED] PHP Display Problem


ChompGator

Recommended Posts

Im having this little problem, I have a table  that is within a php script already and it displays fine. But now, I want to edit the tables apperance, so below is what I want to edit the table too, and below that is the current code that is within the php script. The problem is, when I try and place my newly made table within the php script - I get all kinds of parse errors.

 

Currently there is a table within the php script (as you will see below) But I just am currently using that table, because my new one isn't working yet. - Was wondering if anyone could advise on why Im getting parse errors - and let me know what Im doing wrong :(.

 

Newtable.php

		<h2><table class="outline" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr class="font_title_light" cellspacing="2">
	<td class="style15" style="width: 13%"><strong>Flight</strong></td>
	<td width="20%" class="style14">
	<strong><span class="style14"><span class="style13">Departs</span></span></strong><span class="style13"></a></td>
	<td style="width: 19%" class="style15">
	<strong><span class="style14">Arrives</span></strong></a></td>
	<td width="12%" class="style16"><strong>Time</strong></td>
	<td width="10%" class="style14"></span><strong><span class="style13">Status</span></strong></td>
</tr>
<tr class="S_box">
	<td colSpan="4" class="style13">
	<img height="1" src="https://sabresonicweb.com/F9/application/images/default/spacer.gif" width="1"></td>
</tr>
<tr class="style12" style="PADDING-BOTTOM: 5px; PADDING-TOP: 5px">
	<td class="style13" style="LINE-HEIGHT: 20px; width: 13%;" vAlign="top">
	<br>
	</td>
	<td class="style13" style="LINE-HEIGHT: 20px" vAlign="top"> </td>
	<td class="style13" style="LINE-HEIGHT: 20px; width: 19%;" vAlign="top">
	 </td>
	<td class="style13" style="LINE-HEIGHT: 20px" vAlign="top"> </td>
	<td class="style13"> </td>
</tr>

 

Current-phpcode/table:

<?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 "<table border='0'>
<tr>
<td>Flight</th>
<td>Departs</th>
<td>Arrives</th>
<td>Time</th>
<td>Status</th>
</tr>";while($row = mysql_fetch_array($result))
  {
  echo "<tr>";
  echo "<td>" . $row['flights'] . "</td>";
  echo "<td>" . $row['departs'] . "</td>";
  echo "<td>" . $row['arrives'] . "</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/82677-solved-php-display-problem/
Share on other sites

The parse errors will be caused by quotes, you must put a \ before every quote when echoing. eg:

 

<?php

echo "<td width=\"50\">"; // <td witdh="50">

?>

 

Try putting a \ before each quote when you put your styled table into the PHP code

So this is what Ive edited it too, take a look, see if it looks alright to you

 

		<h2><table class="outline" cellSpacing="0" cellPadding="0" width="100%" border="0">
<tr class="font_title_light" cellspacing="2">
	<td class=\"style15\" style=\"width: 13%\"><strong>Flight</strong></td>
	<td width=\"20%\" class=\"style14\">
	<strong><span class=\"style14\"><span class=\"style13\">Departs</span></span></strong><span class=\"style13\"></a></td>
	<td style=\"width: 19%\" class=\"style15\">
	<strong><span class=\"style14\">Arrives</span></strong></a></td>
	<td width=\"12%\" class=\"style16\"><strong>Time</strong></td>
	<td width=\"10%\" class=\"style14\"></span><strong><span class=\"style13"\>Status</span></strong></td>
</tr>
<tr class="S_box">
	<td colSpan="4" class="style13">
	<img height="1" src="https://sabresonicweb.com/F9/application/images/default/spacer.gif" width="1"></td>
</tr>
<tr class=\"style12\" style="PADDING-BOTTOM: 5px; PADDING-TOP: 5px">
	<td class=\"style13\" style="LINE-HEIGHT: 20px; width: 13%;" vAlign=\"top\">
	<br>
	</td>
	<td class=\"style13\" style="LINE-HEIGHT: 20px" vAlign=\"top\"> </td>
	<td class=\"style13\" style="LINE-HEIGHT: 20px; width: 19%;" vAlign=\"top\">
	 </td>
	<td class=\"style13\" style="LINE-HEIGHT: 20px" vAlign=\"top\"> </td>
	<td class=\"style13\"> </td>
</tr>
</table>
	</

	<h2><table class=\"outline\" cellSpacing=\"0\" cellPadding=\"0\" width=\"100%\" border=\"0\">
<tr class=\"font_title_light\" cellspacing=\"2\">
<td class=\"style15\" style=\"width: 13%\"><strong>Flight</strong></td>
<td width=\"20%\" class=\"style14\">
<strong><span class=\"style14\"><span class=\"style13\">Departs</span></span></strong><span class=\"style13\"></a></td>
<td style=\"width: 19%\" class=\"style15\">
<strong><span class=\"style14\">Arrives</span></strong></a></td>
<td width=\"12%\" class=\"style16\"><strong>Time</strong></td>
<td width=\"10%\" class=\"style14\"></span><strong><span class=\"style13\">Status</span></strong></td>
</tr>
<tr class=\"S_box\">
<td colSpan=\"4\" class=\"style13\">
<img height=\"1\" src=\"https://sabresonicweb.com/F9/application/images/default/spacer.gif\" width=\"1\"></td>
</tr>
<tr class=\"style12\" style=\"PADDING-BOTTOM: 5px; PADDING-TOP: 5px\">
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 13%;\" vAlign=\"top\">
<br>
</td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px\" vAlign=\"top\"> </td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 19%;\" vAlign=\"top\">
 </td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px\" vAlign=\"top\"> </td>
<td class=\"style13\"> </td>
</tr>

 

You missed some! Now all you need to do is adapt that to your PHP code.

Here is the new code, (Parse Error Line 92)

 

<?php
$con = mysql_connect("****","****","8888") 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=\"100%\" border=\"0\">
<tr class=\"font_title_light\" cellspacing=\"2\">
<td class=\"style15\" style=\"width: 13%\"><strong>Flight</strong></td>
<td width=\"20%\" class=\"style14\">
<strong><span class=\"style14\"><span class=\"style13\">Departs</span></span></strong><span class=\"style13\"></a></td>
<td style=\"width: 19%\" class=\"style15\">
<strong><span class=\"style14\">Arrives</span></strong></a></td>
<td width=\"12%\" class=\"style16\"><strong>Time</strong></td>
<td width=\"10%\" class=\"style14\"></span><strong><span class=\"style13\">Status</span></strong></td>
</tr>
<tr class=\"S_box\">
<td colSpan=\"4\" class=\"style13\">
<img height=\"1\" src=\"https://sabresonicweb.com/F9/application/images/default/spacer.gif\" width=\"1\"></td>
</tr>
<tr class=\"style12\" style=\"PADDING-BOTTOM: 5px; PADDING-TOP: 5px\">
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 13%;\" vAlign=\"top\">
<br>
</td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px\" vAlign=\"top\"> </td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 19%;\" 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['flight'] . "</td>";
  echo "<td>" . $row['departs'] . "</td>";
  echo "<td>" . $row['arrives'] . "</td>";
  echo "<td>" . $row['time'] . "</td>";
  echo "<td>" . $row['status'] . "</td>";
  echo "</tr>";
  }
echo "</table>";mysql_close($con);
?>

 

 

 

Im looking at line 92 now to see if I can tell whats wrong.

 

 

(edited by kenrbnsn to remove DB username/password)

This is the code (sorry) - Can you see it all?

 

<?php
$con = mysql_connect("****","****","****") 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=\"100%\" border=\"0\">
<tr class=\"font_title_light\" cellspacing=\"2\">
<td class=\"style15\" style=\"width: 13%\"><strong>Flight</strong></td>
<td width=\"20%\" class=\"style14\">
<strong><span class=\"style14\"><span class=\"style13\">Departs</span></span></strong><span class=\"style13\"></a></td>
<td style=\"width: 19%\" class=\"style15\">
<strong><span class=\"style14\">Arrives</span></strong></a></td>
<td width=\"12%\" class=\"style16\"><strong>Time</strong></td>
<td width=\"10%\" class=\"style14\"></span><strong><span class=\"style13\">Status</span></strong></td>
</tr>
<tr class=\"S_box\">
<td colSpan=\"4\" class=\"style13\">
<img height=\"1\" src=\"https://sabresonicweb.com/F9/application/images/default/spacer.gif\" width=\"1\"></td>
</tr>
<tr class=\"style12\" style=\"PADDING-BOTTOM: 5px; PADDING-TOP: 5px\">
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 13%;\" vAlign=\"top\">
<br>
</td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px\" vAlign=\"top\"> </td>
<td class=\"style13\" style=\"LINE-HEIGHT: 20px; width: 19%;\" 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['flight'] . "</td>";
  echo "<td>" . $row['departs'] . "</td>";
  echo "<td>" . $row['arrives'] . "</td>";
  echo "<td>" . $row['time'] . "</td>";
  echo "<td>" . $row['status'] . "</td>";
  echo "</tr>";
  }
echo "</table>";mysql_close($con);
?>

 

 

(edited by kenrbnsn to remove DB username/password)

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.