Hi i have two question to ask here the warning message on page
Warning: arsort() expects parameter 1 to be array, string given in /var/www/admin/image_list.php on line 42, i have google through the net and i have found a way of removing the warning by placing the @arsort before the function , i was also getting filetime warning and i need to find out the reason why i shud put the @ sign and what cause these error messages
Invalid argument supplied for foreach , this code works perfectly on the local host but as soon as a i upload it on my web server it give me problems , pls help
Warning: Invalid argument supplied for foreach() in /var/www/admin/image_list.php on line 45
here is the code its for viewing the images i have uploaded
<?php
$whatField = $_REQUEST['whatField'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Administrator Control Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="styles/admin.css" type="text/css">
</head>
<body>
<?php
$banners = '';
$bannerDir = '../photos/';
$i = 0;
array($banners);
$d = dir($bannerDir);
$fileArray = '';
array($fileArray);
$fileTimeArray = '';
array($fileTimeArray);
while (false !== ($entry = $d->read()))
{
if (strlen($entry) > 2)
{
list($imageName,$imageExtension) = split('[.]',$entry);
if (eregi('jpg|jpeg',$imageExtension))
{
$file = $bannerDir.$entry;
$fileArray[$entry] = date('U', filemtime($file));
$fileTimeArray[$entry] = date('j F Y H:i', filemtime($file));
}
$banners[$i] = $entry;
$i++;
}
}
$d->close();
arsort($fileArray);
echo '<table cellpadding="3" cellspacing="1" border="0" style="width:100%; margin-top: 10px" style="position:relative; ">'."\n";
echo '<tr class="tableHeading"><td>Image name</td><td>View image</td><td>Date uploaded</td><td>Use image</td></tr>'."\n";
foreach ($fileArray as $key => $value) {
$class = ($class == "adminRow1") ? "adminRow2" : "adminRow1";
echo '<tr class="'.$class.'"><td>'.$key.'</td><td><a target="_blank" href="../photos/'.$key.'">View image</a></td><td>'.$fileTimeArray[$key].'</td><td><a onclick="opener.document.getElementById(\''.$whatField.'\').value=\'../photos/'.$key.'\'; window.close()" href="javascript:void(0)">Use image</a></td></tr>'."\n";
}
echo '</table>'."\n";
?>
</body>
</html>