I've been working on this for the last couple hours and haven't had much luck. Basically, every time you visit the index of my site a random image is shown. The images are stored in a directory, and i use a table to holding the id, name, and url of each image. When the index page is loaded a random int is chosen, and the id = to the int displays the corresponding url for the image.
Now i'm trying to add the id into the url, "domain.com?img=1". I also need this url to always refer to the image in row 1.
I'm pretty lost, any help is greatly appreciated.
Need Help Setting Up Dynamic URL's
Moderator: General Moderators
- novice4eva
- Forum Contributor
- Posts: 327
- Joined: Thu Mar 29, 2007 3:48 am
- Location: Nepal
Re: Need Help Setting Up Dynamic URL's
Why don't you redirect to domain.com?img=1 when the user goes to domain.com - you can check the existence of get parameter and if there is no img param redirect.
Regards,
Dee
Regards,
Dee
Re: Need Help Setting Up Dynamic URL's
So every time the page is loaded, a random number is generated that maps to an image. Simply change where your number comes from. If $_GET['img'] is set, us it, otherwise generate a random number.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.