chiba Posted July 29, 2012 Share Posted July 29, 2012 Can someone explain why this table sits outside of the div? <?PHP mysql_connect('mickey','mouse', 'donald'); mysql_select_db('duck'); $sql = mysql_query("SELECT * FROM Links"); $limit = 1; $count = 0; $output = ""; echo "<table border='1'>"; while ($row = mysql_fetch_array($sql)) { $Name = $row['Name']; $Description = $row['Description']; $Link = $row['Link']; if ($count < $limit) { if ($count ==0) { $output .= "<tr>"; } // Title $output .= "<td>Site name</td><td>Category</td>"; } else { $count = 0; $output .= "</tr><tr><td><a href='$Link'>$Name</a></td><td>$Description</td>"; } $count++; } $output .= "</tr></table>"; ?> <body> <div id="page"> <?php include("include_header.php"); ?> <div id="mainContainer"> <?php include("include_menu.php"); ?> <div id="main"> <h2>Links</h2> <p>The contents of the table below are held in a MySQL database and the table is rendered dynamically when the page is loaded.</p> <?php echo $output ?> <p>Table</p> <div class="clear"> </div><!--main end--> <div class="clear"> </div> </div><!--mainContainer end--> <div class="clear"> </div> <?php include("include_footer.php"); ?> </body> </html> #page { margin-right:auto; margin-left:auto; width:900px; /*height:590px;*/ height:auto; } #header { width:900px; height:80px; } #mainContainer { margin-top:5px; margin-left:auto; margin-right:auto; background-color:#6e6e6e; -moz-border-radius: 5px; border-radius: 5px; width:890px; /*height:700px;*/ height:auto; padding:5px; overflow:hidden; } #main { background-color:#FFFFFF; -moz-border-radius: 5px; border-radius: 5px; width:736px; /*height:695px;*/ height:auto; margin:0 auto; float:right; /*overflow: auto;*/ padding-left:5px; border: 2px solid #000; overflow:hidden; } #menu { background-color:#FFFFFF; -moz-border-radius: 5px; border-radius: 5px; width:135px; /*height:695px;*/ height:100%; float: left; padding-left:5px; padding-bottom:5px; border: 2px solid #000; } #footer { width:890px; height:60px; background-color:#6e6e6e; -moz-border-radius: 5px; border-radius: 5px; margin-top:5px; padding:5px; } #footerContent { background-color:#FFFFFF; -moz-border-radius: 5px; border-radius: 5px; width:886px; height:56px; text-align:center; border: 2px solid #000; } Quote Link to comment https://forums.phpfreaks.com/topic/266416-php-query-sits-outside-of-main-div/ Share on other sites More sharing options...
Christian F. Posted July 29, 2012 Share Posted July 29, 2012 If you take a look at line 10 in your code of the first code block, you should be able to spot it right away. Quote Link to comment https://forums.phpfreaks.com/topic/266416-php-query-sits-outside-of-main-div/#findComment-1365276 Share on other sites More sharing options...
chiba Posted July 29, 2012 Author Share Posted July 29, 2012 Cheers Quote Link to comment https://forums.phpfreaks.com/topic/266416-php-query-sits-outside-of-main-div/#findComment-1365280 Share on other sites More sharing options...
Christian F. Posted July 29, 2012 Share Posted July 29, 2012 You're welcome. Quote Link to comment https://forums.phpfreaks.com/topic/266416-php-query-sits-outside-of-main-div/#findComment-1365282 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.