...

View Full Version : PHP generated table causing panel to be screwy



fl00d
07-07-2007, 08:05 AM
Hi,

On my site, I've got one problematic page (so far). There is supposed to be an automatically generated table with all the users of the site contained in it. I used PHP for that, but I don't think the script is the problem.

When the page loads, the right side panel gets all out of alignment, and its only for that one page. All the rest are fine.

View page at: www.mtbhu.com/flaw/index.php?page=members

Here is the CSS I used:


html, body {
min-height:100%;
background:#000000;
}

a img {
border:0;
vertical-align:bottom;
padding:0px;
display:inline;
}

.container {
margin:0 auto;
clear:both;
width:950px;
height:1100px;
color:#000000;
font-family:Verdana, Times New Roman, Arial;
font-size:12px;
}

#header {
margin:0 auto;
width:950px;
height:159px;
}

#navbar {
margin:0 auto;
width:950px;
height:34px;
}

#lpanel {
background: url('/flaw/images/panel_left.gif');
width:239px;
height:906px;
margin:0 auto;
float:left;
}

#content {
margin:0 auto;
float:left;
background:#CCCCCC;
width:472px;
height:906px;
}

#contentTxt{
width:452px;
height:984px;
}

#contentTxt th {
font-size:14px;
}

#contentTxt td {
font-size:12px;
}

#rpanel {
background: url('/flaw/images/panel_right.gif');
width:238px;
height:906px;
margin:0 auto;
float:right;
}


This is the PHP code for the table, although I don't think it is the problem.


<?php
include("/home/conbin/public_html/php/config.php");
$connect = mysql_connect("$host","$user","$passwd");
if(!$connect)
{
die("Could not connect: " .mysql_error());
}

//select database
mysql_select_db("$dbname", $connect);

$table_name = "members"; //insert table name here
$return = mysql_query("SELECT * FROM $table_name"); //get value from members

echo "<table border='1' width='400' style='font-size:12px;' align='center'>
<tr>
<th>Username</th>
<th>Location</th>
<th>Xfire</th>
<th>MSN</th>
<th>Join Date</th>
";

while($row = mysql_fetch_array($return))
{
//output data in table
echo "<tr>";
echo "<td>" . $row['user_name'] ."</td>";
echo "<td>" .$row['location'] ."</td>";
echo "<td>" .$row['xfire'] ."</td>";
echo "<td>" .$row['msn'] ."</td>";
echo "<td>" .$row['create_date'] ."</td>";
echo "</tr>";
}
?>

Generated HTML:

<html>
<head>
<title>*Flaw >> Where the Real Fun Begins*</title>
<style>
html, body {
min-height:100%;
background:#000000;
}

a img {
border:0;
vertical-align:bottom;
padding:0px;
display:inline;
}

.container {
margin:0 auto;
clear:both;
width:950px;
height:1100px;
color:#000000;
font-family:Verdana, Times New Roman, Arial;
font-size:12px;
}

#header {
margin:0 auto;
width:950px;
height:159px;
}

#navbar {
margin:0 auto;
width:950px;
height:34px;
}

#lpanel {
background: url('/flaw/images/panel_left.gif');
width:239px;
height:906px;
margin:0 auto;
float:left;
}

#content {
margin:0 auto;
float:left;
background:#CCCCCC;
width:472px;
height:906px;
}

#contentTxt{
padding:20px;
}

#contentTxt th {
font-size:14px;
}

#contentTxt td {
font-size:12px;
}

#rpanel {
background: url('/flaw/images/panel_right.gif');
width:238px;
height:906px;
margin:0 auto;
float:right;
}

</style>
</head>
<body>
<div class="container">
<div id="header"><img src="/flaw/images/index_01.gif"></div>
<div id="navbar"><a href='/flaw/'><img src='/flaw/images/nav_home.gif'></a><a href='/flaw/index.php?page=news'><img src='/flaw/images/nav_news.gif'></a><a href='/flaw/index.php?page=members'><img src='/flaw/images/nav_roster.gif'></a><a href='/flaw/index.php?page=downloads'><img src='/flaw/images/nav_downloads.gif'></a><a href='http://www.flawclan.com/' target='_blank'><img src='/flaw/images/nav_forum.gif'></a><a href='/flaw/index.php?page=server'><img src='/flaw/images/nav_server.gif'></a><a href='/flaw/index.php?page=contact'><img src='/flaw/images/nav_contact.gif'></a><a href='/flaw/index.php?page=about'><img src='/flaw/images/nav_about.gif'></a></div>
<div id="lpanel"></div>

<div id="content">
<div id="contentTxt">
<table border='1' width='300' align='center'>
<tr>
<th>Username</th>
<th>Location</th>
<th>Xfire</th>

<th>MSN</th>
<th>Join Date</th>
<tr><td>Test</td><td>Test City</td><td>
Test Xfire</td><td>Test MSN</td><td>2007-07-07</td></tr> </div>
</div>

<div id="rpanel"></div>

</div>
</body>
</html>

Any idea's? I'm out of them for the moment =/

_Aerospace_Eng_
07-07-2007, 08:12 AM
Well validating (http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.mtbhu.com%2Fflaw%2Findex.php%3Fpage%3Dmembers) your page shows you have some errors that are likely causing the issue. Having a doctype will also help.

BWiz
07-07-2007, 08:16 PM
This is your generated table.



<table border='1' width='400' style='font-size:12px;' align='center'>
<tr>
<th>Username</th>
<th>Location</th>
<th>Xfire</th>

<th>MSN</th>
<th>Join Date</th>
<tr><td>Test</td><td>Test City</td><td>
Test Xfire</td><td>Test MSN</td><td>2007-07-07</td></tr></table><tr><td>Padapwn</td><td>You Wish ;)</td><td>

-</td><td>powerbomb360@hotmail.com</td><td>2007-07-08</td></tr></table>


I believe this is what it should be generated as:



<table border='1' width='400' style='font-size:12px;' align='center'>
<tr>
<th>Username</th>
<th>Location</th>
<th>Xfire</th>
<th>MSN</th>
<th>Join Date</th>
</tr>
<tr>
<td>Test</td>
<td>Test City</td>
<td>Test Xfire</td>
<td>TestMSN</td>
<td>2007-07-07</td>
</tr>
</table>
<tr>
<td>Padapwn</td>
<td>You Wish ;)</td>
<td> -</td>
<td>powerbomb360@hotmail.com</td>
<td>2007-07-08</td>
</tr>
</table>


The red means it should be there, the blue means it shouldn't.

Also, I don't see your right column out of alignement at all.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum