ChompGator Posted December 21, 2007 Share Posted December 21, 2007 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); ?> Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/ Share on other sites More sharing options...
chigley Posted December 21, 2007 Share Posted December 21, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420493 Share on other sites More sharing options...
ChompGator Posted December 21, 2007 Author Share Posted December 21, 2007 So your saying everywhere, where I have echoed I need a \ Do I understand that properly? Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420503 Share on other sites More sharing options...
chigley Posted December 21, 2007 Share Posted December 21, 2007 <td class="style15" style="width: 13%"><strong>Flight</strong></td> Would become <td class=\"style15\" style=\"width: 13%\"><strong>Flight</strong></td> Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420505 Share on other sites More sharing options...
ChompGator Posted December 21, 2007 Author Share Posted December 21, 2007 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> </ Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420508 Share on other sites More sharing options...
chigley Posted December 21, 2007 Share Posted December 21, 2007 <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. Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420511 Share on other sites More sharing options...
ChompGator Posted December 21, 2007 Author Share Posted December 21, 2007 Good stuff, thanks Im going to give it a try Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420512 Share on other sites More sharing options...
ChompGator Posted December 21, 2007 Author Share Posted December 21, 2007 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) Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420516 Share on other sites More sharing options...
chigley Posted December 21, 2007 Share Posted December 21, 2007 There's only 46 lines in the code you posted.. Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420519 Share on other sites More sharing options...
ChompGator Posted December 21, 2007 Author Share Posted December 21, 2007 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) Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420520 Share on other sites More sharing options...
chigley Posted December 21, 2007 Share Posted December 21, 2007 There's still only 46 lines there, is this solver now? P.S. I suggest you remove your DB credentials. Quote Link to comment https://forums.phpfreaks.com/topic/82677-solved-php-display-problem/#findComment-420529 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.