0

Okay, first of all, I'm quite new to programming at this level.
I have managed to create a dynamic administrationpanel for updating
the current menues of a restaurants homepage.

ISSUE -

The more posts in the table, the longer the space between the page top and the databasetable gets. I’ve tried about everything, and as you can see, the table that is beneath had the same range between the arrows as shown - until I deleted all but two posts. I can’t understand why that happens, please help me to understand the issue.

I want the top table to act as the one on the lower.
See pic:

http://i48.tinypic.com/t8uue9.png

Give me a hint to where my problem is or help me to understand why this happens.
Thankfully yours, Vingklippt

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--

table.sample td {
    border-width: 1px;
    padding: 1px;
    border-style: solid;
    border-color: gray; }

table.sample2 td {
    border-width: 0px;
    padding: 0px; ;
}

body {
    margin-left: 0px;
    margin-top: 14px;
    margin-right: 0px;
}
body,td,th {
    color: #333;
    font-family: verdana;
    text-shadow: white 1px 1px;
    font-size: 9px;
}


a {
    font-family: verdana;
    font-size: 9px;
    color: #333;
}
a:link {
    font-size: 9px;
    color: #333;
}
a:visited {
    font-size: 9px;
    color: #333;
}
a:hover {
    text-decoration: none;
    color: #FF0000
    font-size: 9px;
    color: #666;
}
a:active {
    color: #333;
}

-->
</style>
</head>
<body><center>
<table width="750" background="bg.png" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="loginaccess2.php"><img src="admin.png" width="750" height="20" border="0" /></a></td>
  </tr>
  <tr>
    <td align="center" valign="top">
      <br />
      <table width="700" border="0" align="center" cellpadding="4" cellspacing="6" bordercolor="#999999" class="sample" colspan="5">

<tr>
<td colspan="8" align="center">
  <h1><strong>PIZZAMENY</strong></h1></td>
</tr>
<tr>
          <td width="92" height="30" align="center" bgcolor="#93FF93"><strong><font color="#000000">Titel</font></strong></td>
          <td width="42" align="center" bgcolor="#DDFFDD"><strong><font color="#000000">Nr</font></strong></td>
          <td width="172" align="center" bgcolor="#DDFFDD"><strong><font color="#000000">Ingrediens</font></strong></td>
          <td width="52" align="center" bgcolor="#DDFFDD"><strong><font color="#000000">Pris</font></strong></td>
          <td width="102" align="center" bgcolor="#93FF93"><strong><font color="#000000">Uppdatera</font></strong></td>
          <td width="100" align="center" bgcolor="#FF5353"><strong><font color="#000000">Ta bort</font></strong></td>
        </tr>
<?php
$host="***********"; // 
$username="**********"; // 
$password="***********"; // 
$db_name="**********"; // 
$tbl_name="********"; // 

mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<?php
while($rows=mysql_fetch_array($result)){
?>
        <tr>
          <td height="60" align="center" bgcolor="#DDFFDD"><font style="font-size:9px;"><? echo $rows['titel']; ?></font></td>
          <td height="60" align="center" bgcolor="#E9E9E9"><font style="font-size:9px;"><? echo $rows['nummer']; ?></font></td>
          <td height="60" align="center" bgcolor="#E9E9E9"><font style="font-size:9px;"><? echo $rows['ingrediens']; ?></font></td>
          <td height="60" bgcolor="#E9E9E9"><font style="font-size:9px;"><center><? echo $rows['pris']; ?></center></font></td>
          <td height="60" align="center"><a href="updatepizza-process.php?id=<? echo $rows['id']; ?>">Uppdatera</a></td>
          <br />
          <td height="60" align="center"><a href="update-delete.php?id=<? echo $rows['id']; ?>">Ta bort</a> <strong><font style="text-shadow:none;"" color="#FF0000">!</font></strong></td>
        </tr>
<?php } ?>
</table>
<strong>PASTA, KEBAB &amp; FALAFEL-MENY</strong>

      <table width="700" border="0" align="center" cellpadding="4" cellspacing="6" bordercolor="#999999" class="sample" colspan="5">
  <?php
$host="***********"; // 
$username="**********"; // 
$password="***********"; // 
$db_name="**********"; // 
$tbl_name="********"; // 

mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<tr>
          <td width="92" height="30" align="center" bgcolor="#93FF93"><strong><font color="#000000">Titel</font></strong></td>
          <td width="42" align="center" bgcolor="#DDFFDD"><strong><font color="#000000">Nr</font></strong></td>
          <td width="172" align="center" bgcolor="#DDFFDD"><strong><font color="#000000">Ingrediens</font></strong></td>
          <td width="52" align="center" bgcolor="#DDFFDD"><strong><font color="#000000">Pris</font></strong></td>
          <td width="102" align="center" bgcolor="#93FF93"><strong><font color="#000000">Uppdatera</font></strong></td>
          <td width="100" align="center" bgcolor="#FF5353"><strong><font color="#000000">Ta bort</font></strong></td>
        </tr>
        <?php
while($rows=mysql_fetch_array($result)){
?>
        <tr>
          <td height="60" align="center" bgcolor="#DDFFDD"><font style="font-size:9px;"><? echo $rows['titel']; ?></font></td>
          <td height="60" align="center" bgcolor="#E9E9E9"><font style="font-size:9px;"><? echo $rows['nummer']; ?></font></td>
          <td height="60" align="center" bgcolor="#E9E9E9"><font style="font-size:9px;"><? echo $rows['ingrediens']; ?></font></td>
          <td height="60" bgcolor="#E9E9E9"><font style="font-size:9px;">
            <center>
              <? echo $rows['pris']; ?>
            </center>
          </font></td>
          <td height="60" align="center"><a href="updatepizza-process.php?id=<? echo $rows['id']; ?>">Uppdatera</a></td>
          <br />
          <td height="60" align="center"><a href="update-delete.php?id=<? echo $rows['id']; ?>">Ta bort</a> <strong><font style="text-shadow:none;"" color="#FF0000">!</font></strong></td>
        </tr><?php } ?>
</table>
      <br /></td>
  </tr>
  <tr>
    <td align="center" valign="top">&nbsp;</td>
  </tr>
  <tr>
    <td><table width="750" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="250" valign="top"><br />
        <table width="250" border="0" cellspacing="0">
          <tr>
            <td width="250" height="150" align="right"><center>
              <form action="insert-pizza.php" width="222" method="post"><table width="222" height="120" border="0" align="right" cellpadding="0" cellspacing="0" background="inboxbg1.png" class="sample2">
        <tr>
          <td width="250" height="20" align="center"><img src="inbox1top.png" width="222" height="30" border="0" /></td>
        </tr>
        <tr>
          <td height="10" align="center" ><strong><em class="small">
            <br />
            Titel:</em>
            <img src="bgline.png" width="218" height="10" border="0" /></strong><input style="width:200px;" type="text" id="titel-insert" name="titel-insert"/></td>
        </tr>
        <tr>
          <td height="10" align="center"><strong><em><br />
            Nummer:</em></strong><img src="bgline.png" width="218" height="10" /><input name="nummer-insert" id="nummer-insert" type="text" size="9" /></td>
        </tr>
        <tr>
          <td height="10" align="center"><strong><em><br />
            Ingredienser:</em></strong><img src="bgline.png" width="218" height="10" border="0" /><textarea name="ingrediens-insert" rows="5" id="ingrediens-insert" style="width:200px; resize:none; height:45;"></textarea></td>
        </tr>
        <tr>
          <td height="10" align="center"><strong><em><br />
            Pris:</em></strong><img src="bgline.png" width="218" height="10" border="0" /><input name="pris-insert" id="pris-insert" type="text" size="9" /></td>
        </tr>
        <tr>
          <td height="10" align="center"><br /><input type="submit" value="L&auml;gg till" /></td>
        </tr>
        <tr>
          <td height="10" align="center"><img src="bottom.png" width="222" height="30" border="0" /></td>
        </tr>
              </table>
              </form></center></td>
          </tr>
        </table></td>
      <td width="250" align="center" valign="top"><br /><form action="updatepizza-process.php2" width="222" method="post"><table width="222" height="120" border="0" align="center" cellpadding="0" cellspacing="0" background="inboxbg1.png" class="sample2">
        <tr>
          <td width="250" height="20" align="center"><img src="top.png" width="222" height="30" border="0" /></td>
        </tr>
        <tr>
          <td height="10" align="center" ><strong><em class="small">
            <br />
            Titel:</em>
            <img src="bgline.png" width="218" height="10" border="0" /></strong><input style="width:200px;" type="text" id="titel-insert" name="titel-insert"/></td>
        </tr>
        <tr>
          <td height="10" align="center"><strong><em><br />
            Nummer:</em></strong><img src="bgline.png" width="218" height="10" /><input name="nummer-insert" id="nummer-insert" type="text" size="9" /></td>
        </tr>
        <tr>
          <td height="10" align="center"><strong><em><br />
            Ingredienser:</em></strong><img src="bgline.png" width="218" height="10" border="0" /><textarea name="ingrediens-insert" rows="5" id="ingrediens-insert" style="width:200px; resize:none; height:45;"></textarea></td>
        </tr>
        <tr>
          <td height="10" align="center"><strong><em><br />
            Pris:</em></strong><img src="bgline.png" width="218" height="10" border="0" /><input name="pris-insert" id="pris-insert" type="text" size="9" /></td>
        </tr>
        <tr>
          <td height="10" align="center"><br /><input type="submit" value="L&auml;gg till" /></td>
        </tr>
        <tr>
          <td height="10" align="center"><img src="bottom.png" width="222" height="30" border="0" /></td>
        </tr>
              </table>
              </form>
      </td>
      <td width="250" align="left" valign="top"><br /><form action="updatepizza-process3.php" width="222" method="post"><table width="222" height="120" border="0" align="left" cellpadding="0" cellspacing="0" background="inboxbg1.png" class="sample2">
        <tr>
          <td width="250" height="20" align="center"><img src="top.png" width="222" height="30" border="0" /></td>
        </tr>
        <tr>
          <td height="10" align="center" ><strong><em class="small">
            <br />
            Titel:</em>
            <img src="bgline.png" width="218" height="10" border="0" /></strong><input style="width:200px;" type="text" id="titel-insert" name="titel-insert"/></td>
        </tr>
        <tr>
          <td height="10" align="center"><strong><em><br />
            Nummer:</em></strong><img src="bgline.png" width="218" height="10" /><input name="nummer-insert" id="nummer-insert" type="text" size="9" /></td>
        </tr>
        <tr>
          <td height="10" align="center"><strong><em><br />
            Ingredienser:</em></strong><img src="bgline.png" width="218" height="10" border="0" /><textarea name="ingrediens-insert" rows="5" id="ingrediens-insert" style="width:200px; resize:none; height:45;"></textarea></td>
        </tr>
        <tr>
          <td height="10" align="center"><strong><em><br />
            Pris:</em></strong><img src="bgline.png" width="218" height="10" border="0" /><input name="pris-insert" id="pris-insert" type="text" size="9" /></td>
        </tr>
        <tr>
          <td height="10" align="center"><br /><input type="submit" value="L&auml;gg till" /></td>
        </tr>
        <tr>
          <td height="10" align="center"><img src="bottom.png" width="222" height="30" border="0" /></td>
        </tr>
              </table>
              </form></td>
      </tr>
    </table>
      <br /><br />
</td>
  </tr>
</table>
<img src="low.png" width="750" height="1" />
</center>
<br />
<br />
<br />
<br />
</body>
</html>
3
Contributors
3
Replies
5
Views
4 Years
Discussion Span
Last Post by Vingklippt
0

SOrry but that's a lot of markup top try and get through. When this happens to me, it tends to be when a <td> is outside the scope of a <tr> or when a <tr> is outside a <table>. Check your markup in 'view source' in your browser to see if all <td> and <tr> are where they're supposed to be - and that there are the correct number of them (take colspan into account of course).

It seems that you have nested tables too. From the screenshot, I can't work out why they need to be nested.

Also avoid <center> tag - it's deprecated. Mutliple <br /> too - use css margin-bottom or similar.

Edited by diafol

0

Diafol thank you, that was very helpful, in the Firefox-browser it shows red if there seems to be a problem with the code. However, the error was an extra " in one of the style-codes.

But the problem with the php-table was solved by putting in a colspan="8" in the beginning of the table,
thank you very much! Problem solved.

Edited by Vingklippt

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.