Jump to content

PHP Formating HTML??


Vivid Lust

Recommended Posts

Hey, I have this Leaderboard script at: http://onestamp.co.uk/projects/phishfriends/leader.php

 

Now what is strange, is that when a new field is added to the table, the gap above that table gets bigger, quite weird! Maybe the script may explain why to few:

 

<?php 
session_start();
?>
<?php include("siteincludes/header.php"); ?> 
<!-- content block START -->
<div id="conent">
<?php include("siteincludes/sidebar.html"); ?>
	<!-- left column start-->
	<div class="left_col">
		<div class="db1">
			<div class="db1_title">
				<h3>Leaderboard - Top 20 Phishers</h3> 
			</div>					
			<div class="db1_content">
				<div class="db1_container">


				<?php
require("includes/db.php");
$sql = "select * from users order by `s_phish` desc";
$result = mysql_query($sql, $link)
or die(mysql_error());
?>
<center>
<table cellpadding="0" width="50%" cellspacing="0">
<tr>
<td>
Rank
</td>
<td>
Name
</td>
<td>
Phishes
</td>
</tr>
<?php
$rank = 0;
while ($row = mysql_fetch_array($result) AND $rank < 20) {
     $rank++;   // adds 1
     echo "<tr><td>";
     echo $rank;
     echo "</td><td>";
     echo "  <a href='profile.php?id=";
     echo $row['id'];
     echo "'>";
     echo $row['name'];
     echo "</a> ";
     echo "</td><td>";
     echo $row['s_phish']; // put HTML break to end line
     echo "</td></tr>";
     echo "<br />"; 
}
?>
</table>
</center>
<!-- and more html below here... -->

 

Thanks if you can help.

Link to comment
https://forums.phpfreaks.com/topic/124694-php-formating-html/
Share on other sites

That didnt work,

 

Heres my css:

 

.db1 .db1_content
{
background:#fff url('../images/db1_content_bg.png') no-repeat scroll top right;
}
.db1  .db1_container 
{
background: url('../images/db1_content_bg.png') no-repeat scroll top left;
padding: 10px;
position:relative;
}

Link to comment
https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644743
Share on other sites

You have so many divs on that page, that I'm getting a little lost. Never the less, try adding the "vertical-align: top;" to the CSS of any element that those items are contained in. If that doesn't work, try playing around with it. Try messing it up. Sometimes that helps me see something that I was blind to before.

Link to comment
https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644754
Share on other sites

PHP won't automatically generate a table. I suggest you add the vertical-align: top; to ALL the divs. I think the more likely situation than PHP generating a table is that the divs are defaulting to vertical-align: middle;, because it's not explicitly set.

Link to comment
https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644771
Share on other sites

Yes, but that will only vertically align the elements in the body. Your problem is that the data needs to be vertically aligned in a specific div. But, since we don't know which div is the problem, I suggest either adding it to all of them, or one by one until you see something change.

Link to comment
https://forums.phpfreaks.com/topic/124694-php-formating-html/#findComment-644781
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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