Results 1 to 7 of 7
Thread: Help me please
Jan 3, 2005, 20:46 #1
- Join Date
- Oct 2003
- 0 Post(s)
- 0 Thread(s)
Help me pleasePHP Code:
//this is to generate a random picture from a selected directory.
//the image files must follow the pattern: 1.jpg, 2.jpg, 3.jpg.
//Things to check and change.
$folder = "../pic/"; //path to the folder. (html style) (leave trailing slash)
$number = 20; //number of pictures in the folder
//The actual program itself.
//getting a random number from 1 to whatever user specified.
$random_number = rand(1, 20);
//changing the number into a string for use with the image path.
$random_number = settype($random_number, "string");
//generating the image path.
//displaying the image.
echo "<img src=\"$image\">";
Could someone tell me where I went wrong? ThanksNew site: www.talkutas.com