25-2-2010, 23:52
|
#1 (permalink)
|
Join Date: 25 February 10
Posts: 1
Downloads: 0 Uploads: 0 | Error massage in picture sort script by highest number last Hi,
I would really appreciate some help in figuring out why i get an error message when executing this script: PHP Code: $p = $_GET['p'];
if ($handle = opendir("images")) {
$i = 1;
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$img[$i] = $file;
if ($p == $img[$i]) {
$ci = $i;
}
$i++;
}
}
$itmSorted = order_array_num ($itm, 1, "DESC");
function order_array_num ($array, $key, $order = "ASC")
{
$tmp = array();
foreach($array as $akey => $array2)
{
$tmp[$akey] = $array2[$key];
}
if($order == "DESC")
{arsort($tmp , SORT_STRING );}
Read more on: : i3D.net Game Forums /web-scripting/147272-error-massage-picture-sort-script-highest-number-last.html else
{asort($tmp , SORT_STRING );}
$tmp2 = array();
foreach($tmp as $key => $value)
{
$tmp2[$key] = $array[$key];
}
return $tmp2;
}
closedir($handle);
$ti = $i - 0;
$pi = $ci - 1;
if ($p == "") {
$ni = $ci + 2;
}
else {
$ni = $ci + 1;
}
$prevNext = "";
if ($pi > 0) {
$piFile = $img[$pi];
$prevNext .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?p=" . $piFile . "\" title=\"show previous image\">«</a>";
}
else {
$prevNext .= "«";
}
$prevNext .= " | ";
if ($ni <= $ti) {
$niFile = $img[$ni];
$prevNext .= "<a href=\"" . $_SERVER['PHP_SELF'] . "?p=" . $niFile . "\" title=\"show next image\">»</a>";
}
else {
$prevNext .= "»";
}
if ($p == "") {
$p = $img[1];
}
}
I've been trying to get this to work for days..
Thanks very much,
grt peps |
| |