Jump to content

Code not rendered the same on refresh in IE


daniel244rock

Recommended Posts

Hello and thanks in advance.

I have a page I'm workin on (http://www.blogunique.com/lasaldan/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:
[list]
[*]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.
[/list]

Below is the code used to generate the book review:

[code]
<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>[/code]

Which outputs the following:

[code] <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>[/code]

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.