brem13 Posted March 24, 2009 Share Posted March 24, 2009 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] Quote Link to comment https://forums.phpfreaks.com/topic/150913-solved-footer-isnt-at-bottom/ Share on other sites More sharing options...
MikeDXUNL Posted March 24, 2009 Share Posted March 24, 2009 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) Quote Link to comment https://forums.phpfreaks.com/topic/150913-solved-footer-isnt-at-bottom/#findComment-792795 Share on other sites More sharing options...
brem13 Posted March 24, 2009 Author Share Posted March 24, 2009 nope, that screw up the rows Quote Link to comment https://forums.phpfreaks.com/topic/150913-solved-footer-isnt-at-bottom/#findComment-792801 Share on other sites More sharing options...
lonewolf217 Posted March 24, 2009 Share Posted March 24, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/150913-solved-footer-isnt-at-bottom/#findComment-792807 Share on other sites More sharing options...
brem13 Posted March 24, 2009 Author Share Posted March 24, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/150913-solved-footer-isnt-at-bottom/#findComment-792812 Share on other sites More sharing options...
lonewolf217 Posted March 24, 2009 Share Posted March 24, 2009 yes, I see now what I missed before. after you reset $i==0 you immidiately increment it so that isn't the issue. what is inside footer.php, perhaps the issue is there Quote Link to comment https://forums.phpfreaks.com/topic/150913-solved-footer-isnt-at-bottom/#findComment-792818 Share on other sites More sharing options...
brem13 Posted March 24, 2009 Author Share Posted March 24, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/150913-solved-footer-isnt-at-bottom/#findComment-792828 Share on other sites More sharing options...
brem13 Posted March 24, 2009 Author Share Posted March 24, 2009 fixed it, changed the align=left to align=center Quote Link to comment https://forums.phpfreaks.com/topic/150913-solved-footer-isnt-at-bottom/#findComment-792976 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.