[SOLVED] MSIE Display Problem
Posted: Mon Oct 25, 2004 5:19 pm
Hey guys,
I'm really struggling to figure this one out so I need your help! I have a page written that displays, for admin purposes, all the users registered on a website I'm working on. To ease reading, the code automatically splits the table over pages with 10 on each page. It works fine in Internet Explorer until I have more than 10 records - i.e. when it starts splitting pages. When that happens IE splits the pages fine but the table disappears! It works fine in all other browsers! Can anyone suggest why? Here's the page code:
Thanks for your help guys - appreciated as always!
I'm really struggling to figure this one out so I need your help! I have a page written that displays, for admin purposes, all the users registered on a website I'm working on. To ease reading, the code automatically splits the table over pages with 10 on each page. It works fine in Internet Explorer until I have more than 10 records - i.e. when it starts splitting pages. When that happens IE splits the pages fine but the table disappears! It works fine in all other browsers! Can anyone suggest why? Here's the page code:
Code: Select all
<?php # view_users.php
// This page allows the administrator to view all of the current users.
// Include the configuration file for error management and such.
require_once ('../includes/config.inc');
// Require authentication.
require_once ('../../authentication.php');
// Set the page title and include the HTML header.
$page_title = 'View the Current Users';
include_once ('../includes/admin_header.html');
// Check for authorization.
if (!$authorized) {
echo '<p><font color="red">Please enter a valid username and password! Click <a href="index.php">here</a> to try again!</font></p>';
} else {
require_once ('../../mysql_connect.php'); // Connect to the database.
// Number of records to show per page:
$display = 10;
// Determine how many pages there are.
if (isset($_GET['np'])) { // Already been determined.
$num_pages = $_GET['np'];
} else { // Need to determine.
$query = "SELECT CONCAT(last_name, ', ', first_name) AS name, DATE_FORMAT(registration_date, '%M %d, %Y') AS dr FROM users ORDER BY registration_date ASC"; // Standard query.
$query_result = mysql_query ($query);
$num_records = @mysql_num_rows ($query_result);
if ($num_records > $display) { // More than 1 page.
$num_pages = ceil ($num_records/$display);
} else {
$num_pages = 1;
}
}
// Determine where in the database to start returning results.
if (isset($_GET['s'])) { // Already been determined.
$start = $_GET['s'];
} else {
$start = 0;
}
// Make the query.
$query = "SELECT user_id AS id, username AS username, CONCAT(last_name, ', ', first_name) AS name, DATE_FORMAT(registration_date, '%M %d, %Y') AS dr, email AS em FROM users ORDER BY registration_date ASC LIMIT $start, $display";
$result = @mysql_query ($query); // Run the query.
$num = mysql_num_rows ($result); // How many users are there?
if ($num > 0) { // If it ran OK, display the records.
echo "<h3>Registered Users</h3>";
// Make the links to other pages, if necessary.
if ($num_pages > 1) {
echo '<p>';
// Determine what page the script is on.
$current_page = ($start/$display) + 1;
// If it's not the first page, make a Previous button.
if ($current_page != 1) {
echo '<a href="view_users.php?s=' . ($start - $display) . '&np=' . $num_pages . '">Previous</a> ';
}
// Make all the numbered pages.
for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $current_page) {
echo '<a href="view_users.php?s=' . (($display * ($i - 1))) . '&np=' . $num_pages . '">' . $i . '</a> ';
} else {
echo $i . ' ';
}
}
// If it's not the last page, make a Next button.
if ($current_page != $num_pages) {
echo '<a href="view_users.php?s=' . ($start + $display) . '&np=' . $num_pages . '">Next</a>';
}
echo '</p><br />';
} // End of links section.
// Table header.
echo '<table align="left" cellspacing="1" cellpadding="2">
<tr><td align="left"><div class="p2"><b>ID </b></div></td><td align="left"><div class="p2"><b>Username </b></div></td><td align="left"><div class="p2"><b>Name </b></div></td><td align="left"><div class="p2"><b>Registered</b></div></td> <td align="left"><div class="p2"><b>Email</b></div></td> <td align="left"><div class="p2"> </div></td> <td align="left"><div class="p2"> </div></td> </tr>';
// Fetch and print all the records.
$bg = '#eeeeee'; // Set the background color.
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$bg = ($bg=='#eeeeee' ? '#ffffff' : '#eeeeee'); // Switch the background color.
echo '<tr bgcolor="', $bg, '"><td align="left"><div class="p2">', $row[0], ' </div></td><td align="left"><div class="p2">', $row[1], ' </div></td><td align="left"><div class="p2">', stripslashes($row[2]), ' </div></td><td align="left"><div class="p2">', $row[3], ' </div></td><td align="left"><div class="p2"><a href=mailto:', $row[4], '>', $row[4], '</a> </div></td><td align="left" bgcolor="#ffffff"><div class="p2"><a href=remove.php?id=', $row[0] , '&name=', $row[1] , '><img src=../images/delete.gif border="0" title="Remove This User"></a></div></td> <td align="left" bgcolor="#ffffff"><div class="p2"><a href=editprofile.php?id=', $row[0] , '&name=', $row[1] , '><img src=../images/edituser.gif border="0" title="Edit User"></a></div></td></tr>';
}
echo '</table>'; // Close the table.
mysql_free_result ($result); // Free up the resources.
} else { // If there are no registered users.
echo '<h5>There are currently no registered users.</h5>';
}
mysql_close(); // Close the database connection.
}
include_once ('../includes/admin_footer.html'); // Use the HTML footer file.
?>Thanks for your help guys - appreciated as always!