|
|||||||
| PHP Discussion and technical support for using and deploying PHP based websites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Incrementing values
I'm new to php and i just know the basics right now and what i'm trying to do is create a gallery which I've done successfully the only problem is that there are only 15 images and you will have the ability to comment on them but the comment program i have post to the page and i dont have 16 images is there a way i can make it go from 15 back to 1
also the pages are set up like this index.php?images=1 i need the image variable to go from 15 back to 1 Last edited by Yokiest; 11-04-2009 at 06:50 PM. |
|
#2
|
||||
|
||||
|
put this right after were you add to image number(replace image_num with the name of your variable for image numbers):
if ($image_num==16) $image_num=1;
|
|
#3
|
|||
|
|||
|
Just for safety's sake, use ">", rather than "==". For instance, if you test for equality to 16 and some joker requests "index.php?image=17" you'd be in trouble. In other words, don't test for a single number, test to see if the image number is out of the proper range; if it is, reset.
PHP Code:
Last edited by Sodbuster; 11-04-2009 at 10:17 PM. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|