Jurik Posted December 14, 2006 Share Posted December 14, 2006 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 1349Warning: 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] Quote Link to comment https://forums.phpfreaks.com/topic/30621-unknown-php-error/ Share on other sites More sharing options...
trq Posted December 14, 2006 Share Posted December 14, 2006 The problem is that $rows isn't an array. Where do you define this variable? Quote Link to comment https://forums.phpfreaks.com/topic/30621-unknown-php-error/#findComment-141018 Share on other sites More sharing options...
sanfly Posted December 14, 2006 Share Posted December 14, 2006 Most likely the value of $rows is not an arraytry 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 oneg: print_r($rows); Quote Link to comment https://forums.phpfreaks.com/topic/30621-unknown-php-error/#findComment-141021 Share on other sites More sharing options...
Jurik Posted December 14, 2006 Author Share Posted December 14, 2006 [quote author=sanfly link=topic=118586.msg484696#msg484696 date=1166089400]Most likely the value of $rows is not an arraytry 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 oneg: 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] Quote Link to comment https://forums.phpfreaks.com/topic/30621-unknown-php-error/#findComment-141043 Share on other sites More sharing options...
trq Posted December 14, 2006 Share Posted December 14, 2006 This isn't your code is it?Try to find where the showCalendar() function is called.Oh... and Im moving this thread. Quote Link to comment https://forums.phpfreaks.com/topic/30621-unknown-php-error/#findComment-141047 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.