Jump to content

Archived

This topic is now archived and is closed to further replies.

ShogunWarrior

This Is Freaking Me Out

Recommended Posts

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)
[code]
Select current value from database.
Put opposite of value in variable. (0 or 1)
Update the database with the new value.
[/code]

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.

Share this post


Link to post
Share on other sites
This is really odd, but it can't possibly be Firefox that caused the problem.

Share this post


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

Share this post


Link to post
Share on other sites
it's either a potentially lethal flaw with FireFox or something odd with your code/browsing environment.

Share this post


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

Share this post


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

[b]PS: Thanks pachelbel, I knew I wasn't too crazy :)[/b]

Share this post


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

[b]$t_vars['css_href'][/b] 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. :)

Share this post


Link to post
Share on other sites

×

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.