[PHP] Random include???

2002-12-19 Thread Benjamin Trépanier
Hi, I'm a newbie in php so sorry for that question! I have a table in a html dcc and I want toinclude a file in a cell, but that file must be random so people load a different page each time they refresh... The basic syntax I use for the include is below now, I want to know how to generate

RE: [PHP] Random include???

2002-12-19 Thread Edward Peloke
Won't this work? $random=rand(1,5); print TD WIDTH=77 HEIGHT=435 ROWSPAN=2 align='left'; include(folio_$random.php); -Original Message- From: Benjamin Trépanier [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 9:46 AM To: [EMAIL PROTECTED] Subject: [PHP] Random

Re: [PHP] Random include???

2002-12-19 Thread Justin French
Hi, untested code adapted from a random image thing I have... this works by checking the files in a directory and picking one at random. ? function getRandomFile($start_dir) { chdir($start_dir); $dir = opendir('.'); while (($myfile = readdir($dir)) !==false) { if