Page looks messaged up but can't find the problem

Discussion in 'PHP' started by CuBz, Jul 17, 2009.

  1. #1
    The image below is of what the script shows:

    [​IMG]

    Here is the code:

    <?php
    session_start();
    include"./includes/db_connect.php";
    include"./includes/functions.php";
    logincheck();
    $username=$_SESSION['username'];
    
    
    
    $result11111 = mysql_query("SELECT money, bank FROM users WHERE userlevel='0'");
    
    	$moneytot = 0;
    
    	while($row=mysql_fetch_array($result11111)){
    
    		$moneytot+=$row[0]+$row[1];
    
    	}
    
    		$nums=mysql_num_rows($result11111);
    
    	$per_user = round($moneytot / $nums);
    
    
    
    $ud=mysql_num_rows(mysql_query("SELECT * FROM users"));
    
    $billionaires=mysql_num_rows(mysql_query("SELECT * FROM users WHERE money >= 1000000000"));
    
    ///END
    
    ////SITE STATS
    
    $site=mysql_fetch_object(mysql_query("SELECT * FROM site_stats WHERE id='1'"));
    
    ////END
    
    ////FORUM TOPICS
    
    $totaltopics = mysql_num_rows(mysql_query("SELECT id FROM topics"));
    
    //?END
    
    /////USERS DEAD
    
    $dead= mysql_num_rows(mysql_query("SELECT username FROM users WHERE status = 'Dead'"));
    
    /////TOTAL ATTEMPTS
    
    $attempts= mysql_num_rows(mysql_query("SELECT id FROM attempts WHERE outcome = 'Survived'"));
    
    ///?END
    
    $result11111swiss = mysql_query("SELECT money FROM swiss");
    
    	$moneyswiss = 0;
    
    	while($rowswiss=mysql_fetch_array($result11111swiss)){
    
    		$moneyswiss+=$rowswiss[0];
    
    	}
    
    ?>
    
    <html>
    <head>
    <title>A Mafia Life .::. Celebs</title>
    
    </head>
    <body>
    
    <body background="mainbackground.png">
    
    <table width="600" border="1" align="center" bgcolor=000000 cellspacing="0" cellpadding="0" height='100%' width='500'" >
    
        <tr>
    
          <td class='header' height="30"><div align="center">ML Celebrities </div></td>
    
        </tr>
    
        <tr>
    
          <td class="tableborder"><br />
    
            <table width="450" border="0" align="center" cellpadding="5" cellspacing="0">
    
            <tr>
    
              <td><table width="200" border="2" align="center" cellpadding="0" cellspacing="0">
    
                <tr>
    
                  <td class='header' height="30"><div align="center">Most experience </div></td>
    
                </tr>
    
                <tr>
    
               <?
    
               $e = mysql_query("SELECT * FROM users WHERE userlevel !='6' ORDER BY `rankpoints` DESC LIMIT 10");
    
               while($f = mysql_fetch_array($e)){
    
                       echo "<tr><td bgcolor=#000000><a href='profile.php?viewuser={$f['username']}'><font face=verdana><font size=1><b>{$f['username']}</a> With {$f['rankpoints']}</td></tr>\n";
    
    
    
    
    
               }
    
               ?>
    
              </table></td>
    
              <td>
          <table width="450" border="0" align="center" cellpadding="5" cellspacing="0">
    
            <tr>
    
              <td><table width="200" border="2" align="center" cellpadding="0" cellspacing="0">
    
                  <tr>
    
                    <td class='header' height="30"><div align="center">Most Successful Jail Breaks </div></td>
    
                </tr>
    
                  <tr>
    
    <?
    
               $e = mysql_query("SELECT * FROM user_info WHERE username != 'Cubz' AND username != 'CrookyJ' ORDER BY `busts` DESC LIMIT 10");
    
               while($f = mysql_fetch_array($e)){
    
                       echo "<tr><td bgcolor=#000000><a href='profile.php?viewuser={$f['username']}'><font face=verdana><font size=1><b>{$f['username']}</a> With {$f['busts']}</td></tr>\n";
    
    
    
    
    
               }
    
               ?></tr>
    
              </table></td>
    
              <td><table width="200" border="2" align="center" cellpadding="0" cellspacing="0">
    
                <tr>
    
                  <td class='header' height="30"><div align="center">Most kills </div></td>
    
                </tr>
    
                <tr>
    
    <?
    
               $e = mysql_query("SELECT * FROM user_info WHERE username != 'Cubz' AND username != 'CrookyJ' ORDER BY `kill_skill` DESC LIMIT 10");
    
               while($f = mysql_fetch_array($e)){
    
                       echo "<tr><td bgcolor=#000000><a href='profile.php?viewuser={$f['username']}'><font face=verdana><font size=1><b>{$f['username']}</a> With {$f['kill_skill']}</td></tr>\n";
    
    
    
    
    
               }
    
               ?>
    
              </table></td>
    
            </tr>
    
          </table>
    
          <br />
    
          <table width="450" border="0" align="center" cellpadding="5" cellspacing="0">
    
            <tr>
    
              <td><table width="200" border="2" align="center" cellpadding="0" cellspacing="0">
    
                  <tr>
    
                    <td class='header' height="30"><div align="center">Most  GTAs </div></td>
    
                </tr>
    
                  <tr>
    
    <?
    
               $e = mysql_query("SELECT * FROM user_info WHERE username != 'Cubz' AND username != 'CrookyJ' ORDER BY `gtas` DESC LIMIT 10");
    
               while($f = mysql_fetch_array($e)){
    
                       echo "<tr><td bgcolor=#000000><a href='profile.php?viewuser={$f['username']}'><font face=verdana><font size=1><b>{$f['username']}</a> With {$f['gtas']}</td></tr>\n";
    
    
    
    
    
               }
    
               ?></tr>
    
              </table></td>
    
              <td>
          <table width="450" border="0" align="center" cellpadding="5" cellspacing="0">
    
            <tr>
    
              <td><table width="200" border="2" align="center" cellpadding="0" cellspacing="0">
    
                  <tr>
    
                    <td class='header' height="30"><div align="center">Most Getaways </div></td>
                </tr>
    
                  <tr>
    
    <?
    
               $e = mysql_query("SELECT * FROM user_info WHERE username != 'Cubz' AND username != 'CrookyJ' ORDER BY `get_aways` DESC LIMIT 10");
    
               while($f = mysql_fetch_array($e)){
    
                       echo "<tr><td bgcolor=#000000><a href='profile.php?viewuser={$f['username']}'><font face=verdana><font size=1><b>{$f['username']}</a> With {$f['get_aways']}</td></tr>\n";
    
    
    
    
    
               }
    
               ?></tr>
    
              </table></td>
    
              <td><table width="200" border="2" align="center" cellpadding="0" cellspacing="0">
    
                  <tr>
    
                    <td class='header' height="30"><div align="center">Most Crimes  </div></td>
    
                </tr>
    
                  <tr>
    
     <?
    
               $e = mysql_query("SELECT * FROM user_info WHERE username != 'Cubz' AND username != 'CrookyJ' ORDER BY `crimes` DESC LIMIT 10");
    
               while($f = mysql_fetch_array($e)){
    
                       echo "<tr><td bgcolor=#000000><a href='profile.php?viewuser={$f['username']}'><font face=verdana><font size=1><b>{$f['username']}</a> With {$f['crimes']}</td></tr>\n";
    
    
    
    
    
               }
    
               ?></tr>
    
              </table></td>
    
            </tr>
    
          </table>
          
          <br />
    
     <table width="450" border="0" align="center" cellpadding="5" cellspacing="0">
    
            <tr>
    
              <td><table width="200" border="2" align="center" cellpadding="0" cellspacing="0">
    
                  <tr>
    
                    <td class='header' height="30"><div align="center">Other Stats </div></td>
                </tr>
                <tr>
                  <?
    
               $e = mysql_num_rows(mysql_query("SELECT * FROM user_info WHERE busts >= 5000 AND username != 'Cubz' AND username != 'CrookyJ'"));
    
               echo "<tr><td bgcolor=#000000><font face=verdana><font size=1><b>Micheal Scofield Wannabes</a> = {$e}</td></tr>\n";
    
       $g = mysql_num_rows(mysql_query("SELECT * FROM user_info WHERE kill_skill >= 20 AND username != 'Cubz' AND username != 'CrookyJ'"));
    
               echo "<tr><td bgcolor=#000000><font face=verdana><font size=1><b>World Class Killers</a> = {$g}</td></tr>\n";
    
       $f = mysql_num_rows(mysql_query("SELECT * FROM users WHERE money >= 1000000000 AND userlevel != '6'"));
    
               echo "<tr><td bgcolor=#000000><font face=verdana><font size=1><b>Billionaires</a> = {$f}</td></tr>\n";
    
    		   $h = mysql_num_rows(mysql_query("SELECT * FROM users WHERE rank = 'Official ML God' AND userlevel != '6'"));
    
               echo "<tr><td bgcolor=#000000><font face=verdana><font size=1><b>Official ML Gods</a> = {$h}</td></tr>\n";
    
    
    
    
    
               ?>
                </tr>
              </table></td>
              <br />
    
            </tr>
          </table>
    PHP:
    I cannot seem to figure out what is causing it to be messed up, can anybody help please?

    i want it to look something like this:

    [​IMG]

    Thanks

    EDIT - I didnt code the page shown in the last pic, i created it in photoshop
     
    CuBz, Jul 17, 2009 IP
  2. Rasputin

    Rasputin Peon

    Messages:
    1,511
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It looks like a problem with layout not a php problem, something to do with all the nested tables not being laid out correctly

    your first table is defined as:
    <table width="600" border="1" align="center" bgcolor=000000 cellspacing="0" cellpadding="0" height='100%' width='500'" >
    Code (markup):
    - width is included twice (both different), bgcolor is missing " and #, there is an unnecessary " at the end of the line

    below that you have a nested table width 450, then a nested table 200 width - but I can't see the closing </table> for the 450 table before another 450 width table is defined - so this will be forcing the overall width to go wrong

    I guess there are similar issues further down the code. I'd sort the layout without any coding in before looking at the php.

    Cheers
     
    Rasputin, Jul 17, 2009 IP
  3. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #3
    tables? do it with floating divs...
     
    dimitar christoff, Jul 18, 2009 IP