Jump to content

PHP Query sits outside of main div


chiba

Recommended Posts

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;
}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.