Free Scan: Update Your PC's Outdated Drivers to Optimize Performance
June 23rd, 2008, 04:57 PM
|
#1 (permalink)
| | Senior Member
Join Date: Nov 2001 Location: Central KS
Posts: 830
| Strange behavior in IE/SQL/PHP
I am having an issue recently with IE (v7.0.5730.11) displaying more than 500 records from an SQL query. The browser seems to constantly execute - displaying and rehiding records (and the vertical scrollbar grows and shrinks). I have let the page go for about 5 minutes and it will continue this behavior until a user clicks on the webpage a second time.
I've tried connecting to multiple databases, different webservers, different computers.
Here's the code (stripped down version) PHP Code: <?
$server="someserver";
$username="someuser";
$password="somepwd";
$sqlconnect=mssql_connect($server, $username, $password);
$sqldb=mssql_select_db("sometable",$sqlconnect);
?>
<html>
<head>
<title>Parking Control : Reports</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="lpac.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?
$rep=mssql_query("SELECT TOP 1500 account FROM entries");
?>
<div>
<span class="title" style="width:70px;"><a href="reports_print.php?o=1&<?=''.$v.''; ?>" title="Sort by Ticket #">Ticket#</a></span>
<span class="title" style="width:75px;"><a href="reports_print.php?o=2&<?=''.$v.''; ?>" title="Sort by Date">Date</a></span>
<span class="title" style="width:65px;"><a href="reports_print.php?o=3&<?=''.$v.''; ?>" title="Sort by Paid or Void">Paid/Void</a></span>
</div>
<div>
<?
for($i=0; $i<1500; $i++) {
$row = mssql_fetch_array($rep);
echo '
<div style="clear:both;">
<span class="data" style="width:70px;">'.$row['account'].'</span>
</div>';
} // end while
?>
</body>
</html> I've also changed the for statement to a while statement. Same results.
Firefox seems to execute the code normally, as IE used to. Any ideas to this strange behavior?
__________________
Im against picketing, but I dont know how to show it.
Last edited by bwcc : June 23rd, 2008 at 04:59 PM.
|
| |
June 24th, 2008, 07:46 AM
|
#2 (permalink)
| | Senior Member
Join Date: May 2003 Location: Aus, Gold Coast :)
Posts: 793
|
i could suggest change 1500 to mysql_num_rows($rep) or chage the SQL statement to SELECT account FROM entries LIMIT 0,1500 coupled with while($row = mysql_fetch_assoc) .... but other than that could u split them into pages..... could just be IE,... thats over 4500 lines of HTML code... shouldn't really matter but u never know |
| |
June 25th, 2008, 01:30 PM
|
#3 (permalink)
| | Senior Member
Join Date: Nov 2001 Location: Central KS
Posts: 830
|
SQL doesn't use LIMIT, but thanks.
I did figure out that it is something related to the css style of float:left;
The original code above uses a style sheet that sets the data class as 'float:left;'
Once I remove that (or the css link), it works fine. But to why????? |
| |
June 26th, 2008, 04:02 AM
|
#4 (permalink)
| | Super F@D Folder
Join Date: Jun 2004
Posts: 5,004
|
It sounds to me like the browser is having trouble figuring out where to place everything. Try dropping it to the first 50 records and trying the page. Then what happens? |
| |
June 26th, 2008, 11:06 AM
|
#5 (permalink)
| | Senior Member
Join Date: Nov 2001 Location: Central KS
Posts: 830
|
Exactly. I do notice that if the query results in less than 500 records, it renders fine.
I have modified the code to use a table instead and it's working fine now. Yet, it's still a very odd behavior. I did test it on a clean virtual XP machine as well w/ IE 6 and received the same behavior. |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |