Jump to content


Photo

Code not rendered the same on refresh in IE


  • Please log in to reply
4 replies to this topic

#1 daniel244rock

daniel244rock
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 12 July 2006 - 10:19 PM

Hello and thanks in advance.

I have a page I'm workin on (http://www.bloguniqu...aldan/index.php) which has me puzzled.

All the text on this page is just filler text I threw in the DB so I could see sample text on the page.  You will see in the bottom left corner a space with the heading 'My cool books'.  Under this box is supposed to be a book review, which is recalled from the database.

Now, the weird part...  If you see the book review below the title, then you are lucky.  Well, if you were me you would be.  On my screen the review shows up only about 10% of the time, but at completely random intervals.  Namely, if I hit refresh on the page, the review will be gone for 5 refreshes, then appear for 1, then be gone for 12 then appear again, etc. 

When I view this page in FF it works mostly fine, meaning the book review appears, though occasionally it doesn't pick up on my external css (maybe thats a clue to whats wrong?).

If you view the source code in IE, the book review is written there no matter what.  I've even md5ed the source code from a page that had the review showing and a page that didn't and the source is identical.

I've also tried viewing with a different computer and even a different connection, both with the same results.

I am out of ideas.  So, here are the facts in summary:
  • Page loads properly in IE only 10% of the time or so.
  • Page source is the same whether it works or not.
  • Page loads in FF properly, with the exception of a dropped external stylesheet sometimes.

Below is the code used to generate the book review:

					<h3><strong>my cool books</h3>
					<div class="content">

<?php 

  $query = "SELECT * FROM books WHERE (client_ID='$clientID') ORDER BY date DESC";
  $result = mysql_query($query);
  $num = 1;
  $i = 0;

    while ($i < $num) {

  $date = mysql_result($result,$i,'date');
  $title = mysql_result($result,$i,'title');
  $author = mysql_result($result,$i,'author');
  $description = mysql_result($result,$i,'description');
  $rate = mysql_result($result,$i,'rating');


  echo "<p><strong>".$title."</strong> <br>&nbsp;&nbsp;-<i>".$author."</i> <br>".$description." Rating: ".$rate."/10. <br><b>Finished on: ".$date."</b><br></p>";

   $i ++;
  }

?>
					</div>

Which outputs the following:

<h3><strong>my cool books</h3>
					<div class="content">

<p><strong>My fav Book</strong> <br>&nbsp;&nbsp;-<i>Marty Gerthory</i> <br>A great book that I just made up.  One of my favorites. Rating: 7/10. <br><b>Finished on: 2006-07-10</b><br></p>
					</div>

So, I think the PHP code is working properly, as it is writing what it is supposed to, to the browser.
What else might be the problem? 

I'm sure I've forgot to write something that is critically important in this post (as I tend to do), so if you have any questions I'll answer quickly.  Thanks much for your time!

Daniel

#2 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 12 July 2006 - 10:33 PM

This is a CSS problem, not PHP.

Since you have floated elements, you'll need to clear them at some point.

Try to add style="clear:both;" in the content div and see it shows or not.

Also, try to remove the class all togather and test it.

NoGray.com


#3 daniel244rock

daniel244rock
  • Members
  • PipPip
  • Member
  • 20 posts

Posted 12 July 2006 - 10:54 PM

Alright!

So I added the clear:both; to the div, no difference.

I removed the class from the div and it works consistently now.

Do you know a site that explains why this happened?  I'm still not quite
understanding how it would show up occassionally only.  Is it caching
of the CSS? 

Thanks so much,

Daniel

#4 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 13 July 2006 - 04:34 PM

I am not sure if there any sites that shows this, but it happens to me sometimes when I build CSS layout templates.

I don't know why it happens, but I know it's related to floating elements inside floating elements, and IE sometimes will show it if you select the whole thing or click on it.

NoGray.com


#5 nloding

nloding
  • Members
  • PipPipPip
  • Advanced Member
  • 321 posts

Posted 13 July 2006 - 07:14 PM

Check out:

http://www.positioniseverything.net/

... if you haven't gotten it fixed yet, that is.

I don't know right offhand, but I believe it is something to do with position: relative and position: absolute with regards to floated elements.  That page is full of workarounds and bugs and is INCREDIBLY helpful for CSS debugging.

--Nathan




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users