|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
caching problem (i think) in php
Hi,
I am trying to get php to randomise a value, however it always picks the same number. Sometimes if i change the address bar to be something along the lines of index.php?etgneuj it sometimes works, but even then, only two numbers come up of a rand between 0 and 200. I have tried <? header ("Expires: ".gmdate("D, d M Y H:i:s", time())." GMT"); header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header ("Cache-Control: no-cache, must-revalidate"); header ("Pragma: no-cache"); ?> but it still doesnt work i am using the code $var = rand(0,200); Anyone have any ideas ? ![]() |
|
#2
|
||||
|
||||
|
The following code works like a charm for me with no special header stuff. Is it possible you're using $var elsewhere, perhaps as a session or get/post variable with register_globals turned on?
PHP Code:
|
|
#3
|
|||
|
|||
|
I am not using post / get anywhere, and i am certain that randomNum isnt being over-written
One thing i have just noticed is if the browser has been totally closed (no windows) then re-opened, it generates a number, hit refresh, it generates another number, hit refresh again it goes back to the first number, and however many times you press refresh it will not budge from that number Any other ideas? |
|
#4
|
||||
|
||||
|
I guess check your PHP options and see if there's some kind of caching going on.
|
|
#5
|
|||
|
|||
|
Well that is odd ... it must have been a caching problem on the server ... i put it onto my web server, and it works fine now. Thanks for the help!
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > caching problem (i think) in php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|