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