I'm trying to show about 2/3 images on the same place but all the images are the same. Is there anyway to prevent it from happening and show different images?
How do you know which 3 images to show?
Can you describe how your images are stored, and how you pick 3 of them ... even though you might have 50 of them?
Somewhere, you have to keep track of which image(s) were already displayed.
Using SESSION or COOKIE ..
Do they need to see a unique image each time they visit, or with each page refresh?
And do they need to be displayed in order?
And what happens when the user comes back a different day, does the list start over again?
Or maybe the 3 images rotate automatically (using javascripting)?
It's really hard to answer your original post ... not being sure what the specifications are.
to show image1.jpg image2.jpg image3.jpg. It can be in any order as long as the images are different. It can be on refresh or unique as long as its different. I hope you got my point.
So it's a cache issue then.
Refreshing changes it, so you know it's working.
Try this ...
Duplicate the script 3 times ...
Call them "rotate1.php", "rotate2.php", "rotate3.php"
The same script, but different names ... so it might force it to not cache.
Now put the three of them in your page and see what happens.
Is the reason kind of obvious? All three images are going to be the same, because of the GET. If the GET isn't set it sets it according to the else which in this case you might be doing but it still sets all three images the same in the img tag because the page is calling the script at the same exact time.
__________________ Notice: If you post a problem and it gets fixed, please remember to go back and place it as solved. ;)
I always recommend the HEAD First series of books for learning a new coding language. ^_^