Web Hosting Talk







View Full Version : PHP click to change ?


RS Shamil
05-25-2009, 10:12 AM
Hello, just another quick PHP question here:

How would I go about making a small script whereby:

An image is shown, based on what is in the database.

So, image1 is currently being shown, as is referenced as "1" in the mysql db. I click on the image. Image changes to image2, and is updated in the db as "2". The same for 3, however,when I click on the 3rd image, it cycles back to image 1.

I'm not sure if that's clear enough for you :|

MMrs
05-26-2009, 09:46 AM
Make php script that displays images dynamically by using GET.

HivelocityDD
05-26-2009, 06:19 PM
I would suggest you to use session variable for handling this. So that when session starts it will be 1 by default and for each click it changes the session variable using a counter and if it reaches 3 it resets the variable to 1 again.

updating db and getting it back will make unwanted query to the DB and obviously the loading time ...