Error_log issue (PHP Coding Problem)

pathan420

Newbie
Joined
Jun 28, 2010
Messages
16
Reaction score
1
Hello,

I am using script to list files today I checked the directory where that script is uploaded and I can see that the error_log file was filled with tons of error messages I downloaded the error_log file and noticed the following errors.

Code:
[05-Oct-2012 12:13:56] PHP Warning:  array_multisort() [<a href='function.array-multisort'>function.array-multisort</a>]: Argument #1 is expected to be an array or a sort flag in /home/site/public_html/script/index.php on line 483 [05-Oct-2012 12:13:56] PHP Warning:  Invalid argument supplied for foreach() in /home/site/public_html/script/index.php on line 484

on line 483 and 484 we have the following coding in index.php

PHP:
array_multisort($ftimes2,SORT_DESC,$ftimes);
     foreach ($ftimes as $readd) {

Please help.
 
The problem seems to be $ftimes2 not an array. Test using is_array function.

if(is_array($ftimes2)){
echo' ftimes2 is array';die();
}else{
echo ' ftimes2 is not an array';die();
}

If have no idea about what i am talking about PM me.I can help you if you want.
 
Modify your script as the code below. Changes are highlighted. Close the brace after you foreach loop.
Code:
[COLOR=#b22222][B]if(is_array($ftimes2))[/B][/COLOR]
     array_multisort($ftimes2,SORT_DESC,$ftimes);


[COLOR=#a52a2a][B]if(is_array($ftimes)) {[/B]
[/COLOR]     foreach ($ftimes as $readd) {  

....
...
    } 
[COLOR=#a52a2a][B]}[/B][/COLOR]
 
Back
Top