Jump to content

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


Go to solution Solved by requinix,

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> 
  • Solution

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.

  • Like 1
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.