I've tried using <td></td> and spaces and everything to get it lined up, but all it dies is mess up the outlay of the while loop display. Any help would be greatly appreciated.
Code: Select all
<?php
$bypass = 0;
if($bypass != 1)
{
if(isset($_GET['messages']) || isset($_POST['messages']))
{
$bypass = 1;
$sql = "SELECT * FROM messages WHERE pid='$user_username' ORDER BY date DESC";
$user_query = mysqli_query($db_conx, $sql);
$nr = mysqli_num_rows($user_query);
echo "<left>";
echo "<table border = '0' width = '100%' cellspacing = '5'>";
echo "<td valign = 'top' width = '100%'>";
if (isset($_GET['pn'])) {
$pn = preg_replace('#[^0-9]#i', '', $_GET['pn']);
} else {
$pn = 1;
}
$itemsPerPage = 5;
$lastPage = ceil($nr / $itemsPerPage);
if ($pn < 1) {
$pn = 1;
} else if ($pn > $lastPage) {
$pn = $lastPage;
}
$centerPages = "";
$sub1 = $pn - 1;
$sub2 = $pn - 2;
$add1 = $pn + 1;
$add2 = $pn + 2;
if ($pn == 1) {
$centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $add1 . '">' . $add1 . '</a> ';
} else if ($pn == $lastPage) {
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $sub1 . '">' . $sub1 . '</a> ';
$centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
} else if ($pn > 2 && $pn < ($lastPage - 1)) {
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $sub2 . '">' . $sub2 . '</a> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $sub1 . '">' . $sub1 . '</a> ';
$centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $add1 . '">' . $add1 . '</a> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $add2 . '">' . $add2 . '</a> ';
} else if ($pn > 1 && $pn < $lastPage) {
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $sub1 . '">' . $sub1 . '</a> ';
$centerPages .= ' <span class="pagNumActive">' . $pn . '</span> ';
$centerPages .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $add1 . '">' . $add1 . '</a> ';
}
$limit = 'LIMIT ' .($pn - 1) * $itemsPerPage .',' .$itemsPerPage;
$sql = "SELECT * FROM messages WHERE pid='$user_username' ORDER BY date DESC, readm=1 DESC $limit";
$user_query = mysqli_query($db_conx, $sql);
$numrows = mysqli_num_rows($user_query);
$paginationDisplay = "";
if ($lastPage != "1"){
$paginationDisplay .= 'Page <strong>' . $pn . '</strong> of ' . $lastPage. ' ';
if ($pn != 1) {
$previous = $pn - 1;
$paginationDisplay .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $previous . '"> Back</a> ';
}
$paginationDisplay .= '<span class="paginationNumbers">' . $centerPages . '</span>';
if ($pn != $lastPage) {
$nextPage = $pn + 1;
$paginationDisplay .= ' <a href="' . $_SERVER['PHP_SELF'] . '?messages=1&pn=' . $nextPage . '"> Next</a> ';
}
}
$outputList = '';
while ($row = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) {
$row['subject'] = left($row['subject'], 20) . "...";
if($row['readm'] == 1) {
$outputList .= "<left><font color = 'red'>NEW! </font><left>$row[sender] <left>$row[subject] <left>$row[date] <right><form method='post' action='mafiawarskingdom.php?messages=1'><input type='submit' value='Read'>
<input type='hidden' name='readmessage' value='1'>
<input type='hidden' name='randid' value='$row[randid]'>
<input type='hidden' name='date' value='$row[date]'>
</form>";
}
else
{
$outputList .= " <left></font><left>$row[sender] <left>$row[subject] <left>$row[date] <right><form method='post' action='mafiawarskingdom.php?messages=1'><input type='submit' value='Read'>
<input type='hidden' name='readmessage' value='1'>
<input type='hidden' name='randid' value='$row[randid]'>
<input type='hidden' name='date' value='$row[date]'>
</form>";
}
}
}
?>
Code: Select all
</div>
<div style="padding:6px; background-color:#FFF; border:#999 1px solid;"><?php echo $paginationDisplay; ?></div>
<div align="left"><?php echo "$outputList"; ?></div>
<div style="padding:6px; background-color:#FFF; border:#999 1px solid;"><?php echo $paginationDisplay; ?></div>
<?php
}
echo "</table>";
echo "</td></tr></table>";
echo "</small>";
?>