Need help with While();
Posted: Fri Nov 11, 2005 3:52 pm
I think theres something wrong with my while..... i've tryed many things, but it ends up crashing my Xammp, and it takes a couple minutes to get it back, and its just a pain, so i came here..
Its baically just showing a random image each time the page is loaded, and i have it check to make sure its not he same one it showed last time too..
-NSF
Code: Select all
<?php
include('data.php');
$folder="/NTS/images/tours/";
$query = "SELECT `ID` FROM `invoice line item master`";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while($line = mysql_fetch_array($result, MYSQL_ASSOC)){
$names[]=$line['ID'] . 'small.gif';
}
print_r ($line);
$name = array_rand($names, 1);
while($_SESSION['image']==$name){
$name = array_rand($names, 1);
}
$_SESSION['image']=$name;
$imagething = '<img src="' . $folder . $names[$name] . '" width="180" height="51" alt="">';
?>-NSF