thanks for your help on the books. I did do a search, but I was hoping for something specific to my need to create the table interfaced to the MySQL database.
Here is the code I am using.
<?
$fd = fopen ("file.txt", "r");
while (!feof ($fd))
{
$buffer = fgets($fd, 4096);
$lines[] = $buffer;
}
fclose ($fd);
$counter = count($lines)-2; // number of lines
while ($hit<($counter)){
$random = rand(0, $counter);
$findrandom="$random|";
if (!strstr($rndprev,$findrandom)){
$rndprev.=$findrandom;
$hit++;
}
}
echo '<table border=1>';
$new=explode("|",$rndprev);
for ($i=0;$i<count($new)-1;$i++){
$j=$new[$i];
$myline = explode('|', $lines[$j]);
echo '
<tr>
<td height="257"> <p>
<a href="'.$myline[1].'" target="mainFrame"><img
src="'.$myline[0].'" width="100" height="201" border="0"></a>
</p>
<p align="center">
<strong>'.$myline[3].'<br>
<font size="1">'.$myline[2].'</font>
</strong></p></td>
</tr>';
}
echo '</table>';
?>
file.txt could be contains :
image1.jpg|picture1.htm|description 1 goes here|name1
image2.jpg|picture2.htm|description 2 goes here|name2
image3.jpg|picture3.htm|description 3 goes here|name3
image4.jpg|picture4.htm|description 4 goes here|name4
image5.jpg|picture5.htm|description 5 goes here|name5
image6.jpg|picture0.htm|description 6 goes here|name6
It's dropping one of the entries and it doesn't work if there are less than 6.