ChompGator Posted December 21, 2007 Share Posted December 21, 2007 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 More sharing options...
cmgmyr Posted December 21, 2007 Share Posted December 21, 2007 You ended the table right before your: while($row = mysql_fetch_array($result)) take that out and see what happens Link to comment https://forums.phpfreaks.com/topic/82687-solved-php-table/#findComment-420554 Share on other sites More sharing options...
ChompGator Posted December 21, 2007 Author Share Posted December 21, 2007 Well instead of taking that out, maybe I should just end the table at the end of the echo statements, do you think? Because if I take that script out (the: while($row = mysql_fetch_array($result)) ) then it screws up the table Link to comment https://forums.phpfreaks.com/topic/82687-solved-php-table/#findComment-420556 Share on other sites More sharing options...
ChompGator Posted December 21, 2007 Author Share Posted December 21, 2007 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 More sharing options...
ChompGator Posted December 21, 2007 Author Share Posted December 21, 2007 Does anyone know why the data isn't lining up with the table fields? Its still doing this: <table is here> <table data is displaying over here> - Just wondering? - Id like to close the topic soon - Thanks Link to comment https://forums.phpfreaks.com/topic/82687-solved-php-table/#findComment-420899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.