Jump to content

Unknown PHP error


Jurik

Recommended Posts

Hi I was wondering if anyone could help me with this error I am getting with this script, when I run the script in both explorer and firefox I am getting the following messages

[quote]
Warning: usort(): The argument should be an array in /home/e-smith/files/ibays/Primary/html/mambo/components/com_events/events.php on line 1349

Warning: Variable passed to each() is not an array or object in /home/e-smith/files/ibays/Primary/html/mambo/components/com_events/events.php on line 1350
[/quote]

Now below is what is on both of these lines as well as the whole function it is in, the errors are comming from the usort and while lines but to me it seems fine. Can anyone see the problem?

[code]
function showCalendar ($rows,$year,$month,$day){
    global $mosConfig_offset,$database,$option,$Itemid;
   
    $cellcount = count($rows);   
    usort($rows, "sortEvents");
    while(list($key,$value)=each($rows)) {               
                $id_Array[] = $value->id;                         
                $title_Array[] = $value->title;
                $color_Array[] = $value->color_bar;
                $publish_up_Array[] = $value->publish_up;
                $publish_down_Array[] = $value->publish_down; 
                $reccurtype_Array[] = $value->reccurtype;
                $reccurday_Array[] = $value->reccurday; 
                $reccurweekdays_Array[] = $value->reccurweekdays;         
    }
[/code]
Link to comment
https://forums.phpfreaks.com/topic/30621-unknown-php-error/
Share on other sites

[quote author=sanfly link=topic=118586.msg484696#msg484696 date=1166089400]
Most likely the value of $rows is not an array

try using [url=http://au3.php.net/manual/en/function.print-r.php]print_r()[/url] to print out the array, it might give you an idea whats going on

eg: print_r($rows);
[/quote]

Ok ive tried printing the array but nothing is displayed, i've also looked for the var but cannt find it all I can find is the following in the script

[code]
// SOMES VARIABLES
$option = mosGetParam( $_REQUEST, 'option', 'com_events');
$task = mosGetParam( $_REQUEST, 'task', _CAL_CONF_STARTVIEW);
$mode = mosGetParam( $_REQUEST, 'mode', 'com_events');
$limit = intval( mosGetParam( $_REQUEST, 'limit', '' ) );
$limitstart = intval( mosGetParam( $_REQUEST, 'limitstart', 0 ) );

$offset = intval( mosGetParam( $_REQUEST, 'offset', 0 ) );
$catid = intval( mosGetParam( $_REQUEST, 'catid', 0 ) );
$agid = intval( mosGetParam( $_REQUEST, 'agid', 0 ) );
$keyword = mosGetParam( $_REQUEST, 'keyword', '' );

$pop = mosGetParam( $_REQUEST, 'pop', 0 );
[/code]
Link to comment
https://forums.phpfreaks.com/topic/30621-unknown-php-error/#findComment-141043
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.