Jump to content

God Himself couldn't get this table to the top of the page


ZandarKoad

Recommended Posts

I spent the last two hours deleting parts of the css file until it was all gone.  I've deleted everything I possibly can, and yet the (second) table STILL won't go to the top.  You'll notice I threw in a random non-php table that jumped to the top just fine...

It seems like just having some PHP processing forces the table down some random distance...  I'm lost.

 

Here's the URL:
http://gator3241.hostgator.com/~zandar/zetabeta/index2.php

Here's the code: 

<?php
$servername = "123.123.123.123";
$username = "------";
$password = "------";
$dbname = "zandar_zetabeta";
$firsttablename = "english_phrases";
$secondtablename = "cebuano_phrases";
mysql_connect($servername,$username,$password);
@mysql_select_db($dbname) or die("Unable to select database");
$query="SELECT phrase_index_key, phrase_content, author FROM english_phrases";
$en_result=mysql_query($query);
$en_num=mysql_numrows($en_result);
$query2="SELECT phrase_index_key, phrase_content, author FROM cebuano_phrases";
$ceb_result=mysql_query($query2);
$ceb_num=mysql_numrows($ceb_result);
mysql_close();
?>

<table style="width:100%">
  <tr>
    <td>Jill</td>
    <td>Smith</td> 
    <td>50</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td> 
    <td>94</td>
  </tr>
</table>

<table>
<tr><th>Phrase ID</th><th>English Phrase</th><th>Cebuano Phrase</th><th>Author</th></tr>
<?
$i = 0;
while ($i < $en_num) {
	$field1name = mysql_result($en_result, $i, "phrase_index_key");
	$field2name = mysql_result($en_result, $i, "phrase_content");  //English
	$field3name = mysql_result($ceb_result, $i, "phrase_content"); //Cebuano
	$field4name = mysql_result($en_result, $i, "author");
	echo "<tr>";	
	echo "<td>$field1name</td> <td>$field2name</td> <br> <td>$field3name</td>  <td>$field4name</td> <br>";
	echo "</tr>";
	$i++;
	}
?>
</table> 

You can't put BRs between table cells like that. The browser has to try to deal with the invalid markup you've given it, and it apparently does so by interpreting those as being placed before the table.

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.