[SOLVED] MSIE Display Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply

Do you hate MSIE as much as I do?

Poll ended at Thu Oct 28, 2004 9:00 am

Yes
4
100%
No
0
No votes
What's MSIE?
0
No votes
 
Total votes: 4

grahamd
Forum Newbie
Posts: 14
Joined: Fri Oct 22, 2004 6:32 pm
Location: Scotland, UK

[SOLVED] MSIE Display Problem

Post by grahamd »

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:

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&nbsp;</b></div></td><td align="left"><div class="p2"><b>Username&nbsp;</b></div></td><td align="left"><div class="p2"><b>Name&nbsp;</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">&nbsp;</div></td>   <td align="left"><div class="p2">&nbsp;</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], '&nbsp;&nbsp;&nbsp;</div></td><td align="left"><div class="p2">', $row[1], '&nbsp;&nbsp;&nbsp;</div></td><td align="left"><div class="p2">', stripslashes($row[2]), '&nbsp;&nbsp;&nbsp;</div></td><td align="left"><div class="p2">', $row[3], '&nbsp;&nbsp;&nbsp;</div></td><td align="left"><div class="p2"><a href=mailto:', $row[4], '>', $row[4], '</a>&nbsp;&nbsp;&nbsp;</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! :D
Last edited by grahamd on Tue Oct 26, 2004 9:00 am, edited 2 times in total.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

would you have a link to the live page? It sounds like a typical IE bug where it says "can't render because don't know".
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

suggestion

Post by neophyte »

I've had this problem before with IE. In my case it's usually because there is a missing or incomplete row, column or table tag. I''d double check all my templates and html to make sure things were correct.

Then I'd encourage everyone you know to get a real browser - Firefox.

:wink:
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Well what part is being shown? You need to work out at what point the script is not doing what you expect and then you should be able to identify the problem. Post the source of the outputted page.
grahamd
Forum Newbie
Posts: 14
Joined: Fri Oct 22, 2004 6:32 pm
Location: Scotland, UK

I hate MSIE

Post by grahamd »

Success! After much hair removal and tweaking I discovered the problem. In my CSS file I had specified, under body, a 0.05em letter spacing default. MSIE obviously decided to wave two fingers at this idea. I really, really hate that browser. Why won't people learn and start using Firefox or Netscape? Sheesh!
Post Reply