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. [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 Code (markup): on line 483 and 484 we have the following coding in index.php array_multisort($ftimes2,SORT_DESC,$ftimes); foreach ($ftimes as $readd) { PHP: Please help. -Regards.
We might need the code before these lines, where can you see that ftimes is used to contain an array?
Here is the code: foreach ($mp3s as $gftkey => $gftrow) { if (file_exists($thecurrentdir.$gftrow)) { $ftimes[$gftkey] = array(filemtime('/home/site/public_html/script/' . $thecurrentdir.$gftrow),$gftrow); $ftimes2[$gftkey] = array(filemtime('/home/site/public_html/script/' . $thecurrentdir.$gftrow),$gftrow); } } array_multisort($ftimes2,SORT_DESC,$ftimes); foreach ($ftimes as $readd) { $newmp3s[] = $readd[1]; } $mp3s = $newmp3s; } PHP:
Anywhere above that are you actually defining ftimes2 as an array before you start plugging values into it? If it's bombing because ftimes2 isn't an array... well there's your problem. This would be particularly true if all the file_exists commands return false, as then it might even be undefined... which is something I'd be testing for as well.
R/Sir, I am not good at php stuff, can you please explain it in a way that I may understand it and also guide me which code I should remove or modify. With Regards.