Jump to content


Photo

This Is Freaking Me Out


  • Please log in to reply
6 replies to this topic

#1 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 21 August 2006 - 04:30 PM

Hi guys, bit of a problem with Firefox, which is weird considering this is PHP.

I have some code in a page like so: (pseudo)
Select current value from database.
Put opposite of value in variable. (0 or 1)
Update the database with the new value.

So basically it will just reverse the 1 or 0 in the database every time I refresh the page.

On Internet Explorer and Opera this works fine, I have the new/old value printed out and they reverse each time.

On Firefox it stays the same, I am even printing the SQL query and it doesn't change the value in the UPDATE. How is this possible, considering all the comparison and database functions are obviously server-side.

I also have the time on the page which is always current in Firefox, Opera and IE so it's not caching the whole page anyway.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 21 August 2006 - 05:21 PM

This is really odd, but it can't possibly be Firefox that caused the problem.

#3 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 21 August 2006 - 06:10 PM

But BOTH IE and Opera are going fine.
*** I've just logged all the queries to a file and it turns out every time I refresh the page Firefox seems to do the page twice, which will mean the value ends up being the same after reversed twice.
Other browsers don't do this so I'll have to think why it would, any suggestions?
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 21 August 2006 - 06:12 PM

it's either a potentially lethal flaw with FireFox or something odd with your code/browsing environment.
Legend has it that reading the manual never killed anyone.
My site

#5 pachelbel101

pachelbel101
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 21 August 2006 - 06:19 PM

I encountered this same error in Firefox once, but instead of flipping between 0 and 1, I was incrementing a field.  So each refresh incremented it by 2 instead of 1.  Unfortunately I didn't track down the problem and solution, because for this application it didn't really matter.  But I can back you up and say you're not crazy!  Good luck.

#6 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 21 August 2006 - 06:20 PM

I've isolated the query code to a separate page and it seems to be running OK so there is something that's going wrong somewhere on the page... don't know why it was only on Firefox.

Cheers.

PS: Thanks pachelbel, I knew I wasn't too crazy :)
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#7 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 21 August 2006 - 07:09 PM

Just for closure if anyone is wondering what the problem was it was this:
<link rel="stylesheet" href="<?php echo($t_vars['css_href']); ?>" type="text/css" />

$t_vars['css_href'] was blank because I am working on the code to pull the stylesheet URL.

What's interesting is IE and Opera treated the stylesheet URL as blank and didn't request it but Firefox took the blank string as meaning the current page and requested it, thereby causing two page requests.

Thanks guys, SOLVED. :)
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users