Jump to content

Recommended Posts

hey, i have a script to check a mysql database and display 'friends' if there are 'confirmed' friends and to display it in a table. after it displays the table it should have the footer at the bottom but it isnt, its to the right of the table and extends the page to the right. (screenshot below)

 

here is the code and i have the table ending but it doenst seem like it ends the table, any help?

 

if ($result3 = mysql_db_query($database, "select * from $table WHERE confirmed = 'Yes'")) {

  if (mysql_num_rows($result3)) {

          echo '<font face=tahoma size=3>My Friends</font><br>';

echo '<table align=left width=100%><tr>';

$i = 1;

while ($qry = mysql_fetch_array($result2)) {

$friend = $qry[username];

$friend2 = strtoupper($friend);

echo '<td align=left width=150px><a href=galleries/members/'.$friend2.'><font face=tahoma size=2>'.$friend.'</font></a></td>';

if($i == 4)

    {

        echo '</tr><tr>';

        $i = 0; // reset counter

    }

    $i++;

}//end while

echo '</tr></table>';

}//end num rows

}//end result3

include("footer.php");

 

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/150913-solved-footer-isnt-at-bottom/
Share on other sites

if ($result3 = mysql_db_query($database, "select * from $table WHERE confirmed = 'Yes'")) {

          if (mysql_num_rows($result3)) { 

                  echo '<font face=tahoma size=3>My Friends</font><br>';

            echo '<table align=left width=100%><tr>';

            $i = 1;

              while ($qry = mysql_fetch_array($result2)) {

                  $friend = $qry[username];

                  $friend2 = strtoupper($friend);

                  echo '<td align=left width=150px><a href=galleries/members/'.$friend2.'><font face=tahoma size=2>'.$friend.'</font></a></td>';

                    if($i == 4)

                        {

                            echo '</tr><tr>';

                            $i = 0; // reset counter

 

    $i++;

                        }

              }//end while

            echo '</tr></table>';

        }//end num rows

      }//end result3

include("footer.php");

 

 

try and put $i++ inside if($i == 4)

please use [ code] tags (without spaces) when posting code to make it easier to read.

 

 

Not sure if it is related to your problem or not but why do you initialize $i=1, but inside your loop you reset it to $i=0. 

i think this would screw up your columns, which may lead to your issue

sorry about the code tags, never knew to use them, but the $i=0 is for the rows, i only want 4 friends displayed per row and it inserts the <tr> where it should be, and that works. i noticed if i put a bunch of line breaks before the footer, it puts the footer at the bottom, but then if there are another few rows of friends added, the footer is to the right again. but i dont want to use line breaks, i shouldnt have to lol

i dont think the footer is the problem as it displays fine on all my other pages except this one, lol

 

<BODY bgcolor="#000000" alink="#999999" vlink="#CCCCCC" link="#FFFFFF" text="#FFFFFF">


<table style="width: 100%">
<hr>
<tr>

	<td width="33%" align="center"><?php echo "<a href='javascript:history.back(1);'><font face=tahoma size=2>Back</font></a>";?></td>
	<td width="33%" align="center"><a href="../../../../../../../../contactadmin.php"><font face="tahoma" size="2">Contact Administrator</font></a></td>
	<td width="34%" align="center"><a href="../../../../../../../../terms.php"><font face="tahoma" size="2">Terms and Conditions</font></a>


        </td>
</tr>
</table>
</body>

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.