Jump to content

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.
Link to comment
https://forums.phpfreaks.com/topic/18205-this-is-freaking-me-out/
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?
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.
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]
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. :)
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.