Need Help Setting Up Dynamic URL's

I’ve been working on this for the last few 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 hold the id, name, and url of each image. When the index page is loaded a random int is chosen, and the id equal to the int prints 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.

My table is called uploaded_images and the columns are id(primary key), name, url.

I’m pretty lost, any help is greatly appreciated.

Sponsor our Newsletter | Privacy Policy | Terms of Service