Home | Scripts | Tutorials | Books | Hosting | Forums | Links|

Navigation:

Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Books
Sample Chapters
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links






 
 

SPONSORS



 
 

Random Images from a database

In this example we will create a database to store some images , we will then display a random image from this database on the page.

ourimages : these are our 5 images.

Save these images and put them in the same directory as the script. Now we will create our database and table .

Now we will insert some values into our table , the syntax for this is as follows

INSERT into image VALUES (' ','flag number 1' , 'AGS001.GIF' );

As you can see we leave the id blank , then we fill in our description and then the url for the images . Note : If you put the images in a directory you will have to change the url.

Below you can see that we have entered one set of details .

Now for the fun part the script , because of the size of this script we have put this on a seperate page for your convenience , just cut and paste the code into your favourite editor and call it whatever you want . Remember and fill in your own hostname , username and password on the first line of the script .

random image script

We have an online example of this , click on refresh to change the images

imagesdb example