Log in

View Full Version : Div Problems



DS928
04-15-2013, 06:17 AM
I have a page that has a table on it. I want to put either 2 divs or 2 table's under the first table. I tried both. Neither one refuses to go under the first table. They either end up in the middle of the first table or squished on the side. Any help is appreciated. Thank you. The link..
Menuhead.com
Baltimore /American/Get Results/Click on name 13.5 then the page opens.

If requested I'll post the page. But it's long. In any case heres a play around page. If this works then I can go to the real page.



<?php
include("Scripts/config.php");
$Lid = $_GET['LocationID'];
mysql_query("SET CHARACTER SET utf8");
$sql=mysql_query("SELECT tblRestaurants.RestName,tblLocations.StreetNumber,tblLocations.Street,
tblLocations.CrossOne, tblLocations.CrossTwo, tblCities.CityName,tblStates.StateName,tblZipCodes.ZipCodeName,
tblLocations.Phone,tblLocations.Email, tblLocations.Fax, tblLocations.SMS, tblLocations.Website,
tblLocations.Rating,tblLocations.Price,tblLocations.Wheelchair,tblLocations.RestPix
FROM tblLocations
INNER JOIN tblRestaurants ON tblRestaurants.RestID = tblLocations.RestID
INNER JOIN tblCities ON tblCities.CityID = tblLocations.CityID
INNER JOIN tblStates ON tblStates.StateID = tblLocations.StateID
INNER JOIN tblZipCodes ON tblZipCodes.ZipCodeID = tblLocations.ZipCodeID
WHERE tblLocations.LocationID = '$Lid'");
while($row=mysql_fetch_array($sql))
{
$RestName = $row['RestName'];
$StreetNumber = $row['StreetNumber'];
$Street = $row['Street'];
$CrossOne = $row['CrossOne'];
$CrossTwo = $row['CrossTwo'];
$City = $row['CityName'];
$State = $row['StateName'];
$ZipCode = $row['ZipCodeName'];
$Phone = $row['Phone'];
$Email = $row['Email'];
$Fax = $row['Fax'];
$SMS = $row['SMS'];
$Website = $row['Website'];
$Rating = $row['Rating'];
$Price = $row['Price'];
$Wheelchair = $row['Wheelchair'];
$RestPix = $row['RestPix'];
}
?>
<?PHP
include("Scripts/config.php");
$Lid = $_GET['LocationID'];

$sqlHours=mysql_query("SELECT * FROM tblHours
WHERE tblHours.LocationID = '$Lid'");
while($row=mysql_fetch_array($sqlHours))
{
$Sun = $row['SunRest'];
$Mon = $row['MonRest'];
$Tue = $row['TueRest'];
$Wed = $row['WedRest'];
$Thur = $row['ThurRest'];
$Fri = $row['FriRest'];
$Sat = $row['SatRest'];
}
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
#container {
width: 960px;
background-color: #FFF;
margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
height: 2200px;
border-right-width: thick;
border-left-width: thick;
border-right-style: solid;
border-left-style: solid;
border-right-color: #F00;
border-left-color: #F00;

}
#layout_top {
position:static;
width:960px;
min-height:300px;
}
#heading_bar {
position:relative;
width:960px;
background:#09F;
height:20px;
padding:6px 0px 6px 0px;
}
#layout_col_left {
background:#003366;
width:240px;
margin:0px 0px 0px 0px;
float:left;
}
#layout_col_right {
width:360px;
float:left;
}
#layout_col_farright {
background:#C36;
width:360px;
float:left;
}

#layout_bottom {
position: relative; bottom: 0px;
background:#09F;
clear:both;
width:960px;
}

</style>
</head>


<body>
<div id="container">
<div id="layout_top">Top</div>
<div id="heading_bar"> Heading Bar </div>

<div id="layout_col_left">
<p>Left Column</p>
</div>

<div id="layout_col_right">
<p>Right Column</p>
</div>


<div id="layout_col_farright">
<p>FarRight Column </p>
<p>
<?php
include("Scripts/config.php");
$Lid = $_GET['LocationID'];
if(!$rs=mysql_query("SELECT tblDetails.DetailName, tblLocDetails.DetailValue,tblDetails.DetailType
FROM tblDetails
INNER JOIN tblLocDetails ON tblLocDetails.DetailID = tblDetails.DetailID
WHERE tblLocDetails.LocationID = '$Lid'
ORDER BY tblDetails.DetailType, tblDetails.DetailName ASC")) {
echo "Cannot parse query";
}
else
{
echo "<table id=\"tblMyStuff\" table width=\"250\" align=\"left\" cellspacing=\"0\">\n";
//echo "<tbody>";

$Cat="";
while($row = mysql_fetch_array($rs)) {
If($Cat!=$row['DetailType']){
echo "<tr><td align='left' style='padding-top: 0px;'><strong>".$row['DetailType']."</strong></td></tr>";
}
$Cat=$row['DetailType'];
echo "<tr>";
echo "<td align='left' style='padding-left: 25px;'>".$row['DetailName']."</td>";
echo "<td align='left'>".$row['DetailValue']."</td>";
echo "</tr>\n";
//echo "</tbody>";
}
}
?>
</p>
</div>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>



</div><!-- container end -->
</body>
</html>

Thank you.

Beverleyh
04-15-2013, 08:20 AM
It might be because you haven't closed your table.

DS928
04-15-2013, 04:36 PM
You're Right! I closed the table and the required div is at the bottom. However; I did not close it correctly, so I'm only getting the first row and the rest of the table data is everywhere. What am I doing wrong?



<?php
include("Scripts/config.php");
$Lid = $_GET['LocationID'];
if(!$rs=mysql_query("SELECT tblDetails.DetailName, tblLocDetails.DetailValue,tblDetails.DetailType
FROM tblDetails
INNER JOIN tblLocDetails ON tblLocDetails.DetailID = tblDetails.DetailID
WHERE tblLocDetails.LocationID = '$Lid'
ORDER BY tblDetails.DetailType, tblDetails.DetailName ASC")) {
echo "Cannot parse query";
}
else
{
echo "<table id=\"tblMyStuff\" table width=\"250\" align=\"left\" cellspacing=\"0\">\n";
echo "<tbody>";

$Cat="";
while($row = mysql_fetch_array($rs)) {
If($Cat!=$row['DetailType']){
echo "<tr><td align='left' style='padding-top: 0px;'><strong>".$row['DetailType']."</strong></td></tr>";
}
$Cat=$row['DetailType'];
echo "<tr>";
echo "<td align='left' style='padding-left: 25px;'>".$row['DetailName']."</td>";
echo "<td align='left'>".$row['DetailValue']."</td>";
echo "</tr>\n";
echo "</tbody>";
echo "</table>";
}
}
?>

Beverleyh
04-15-2013, 04:50 PM
Your first row has only one <td> while the second row has two <td> so either add another <td> to the top row or set the one that's there to have colspan="2"

DS928
04-15-2013, 05:15 PM
Figured the table mess out.


<?php
include("Scripts/config.php");
$Lid = $_GET['LocationID'];
if(!$rs=mysql_query("SELECT tblDetails.DetailName, tblLocDetails.DetailValue,tblDetails.DetailType
FROM tblDetails
INNER JOIN tblLocDetails ON tblLocDetails.DetailID = tblDetails.DetailID
WHERE tblLocDetails.LocationID = '1'
ORDER BY tblDetails.DetailType, tblDetails.DetailName ASC")) {
echo "Cannot parse query";
}
else
{
echo "<table id=\"tblMyStuff\" table width=\"250\" align=\"left\" cellspacing=\"0\">\n";

$Cat="";
while($row = mysql_fetch_array($rs)) {
If($Cat!=$row['DetailType']){
echo "<tr>";
echo "<td align='left' style='padding-top: 0px;'><strong>".$row['DetailType']."</strong></td>";
echo "</tr>";
}
$Cat=$row['DetailType'];
echo "<tr>";
echo "<td align='left' style='padding-left: 25px;'>".$row['DetailName']."</td>";
echo "<td align='left'>".$row['DetailValue']."</td>";
echo "</tr>";
}
echo "</table>";
}
?>


Once again "You Are The Best!" Thank you so very much! This consumed my entire Sunday!

Beverleyh
04-15-2013, 05:37 PM
No problem - Sometimes it just needs a fresh pair of eyes.