kabucek Posted December 11, 2008 Share Posted December 11, 2008 hello @LL, We have registration system and it was working on ok up till now. When someone tries to register for our event there is an error message: warning: invalid argument supplied for foreach() in /home/dir1/dir2/indexReg.php on line 5400 the code from line is: foreach ($classSelectionArray as $classID => $selectionStatus) and there is another message: processTemplateArray: input is not a record array Our php framework is hosted on webhosting company which has centos. Is it possible that they run some update for php services which caused bad interactions with "foreach" function? maybe older version of php or some respository of it handles this differently ? thanks Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/ Share on other sites More sharing options...
trq Posted December 11, 2008 Share Posted December 11, 2008 We need to see more code. In particular, what creates $classSelectionArray? Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-712686 Share on other sites More sharing options...
kabucek Posted December 11, 2008 Author Share Posted December 11, 2008 i digged into the changes and revert old change and now I got similar error but for next lines: Warning: Invalid argument supplied for foreach() in /home/dir1/dir2/indexRegEG.php on line 10833 code: foreach ($tmpPeriodArray as $label=> $itemArray) any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-712757 Share on other sites More sharing options...
Maq Posted December 11, 2008 Share Posted December 11, 2008 That doesn't help. The error is saying either $tmpPeriodArray is NOT an array or in invalid form. Please post HOW this array is created, as requested before. Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-712788 Share on other sites More sharing options...
kabucek Posted December 11, 2008 Author Share Posted December 11, 2008 i did that and there is "NULL" right before the error message. any suggestions now? thanks $tmpPeriodArray=$seminarPeriodListArray; but this was working ok, is it possible by update to the server? maybe php update to new version? Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-713073 Share on other sites More sharing options...
ted_chou12 Posted December 11, 2008 Share Posted December 11, 2008 null means the variable is empty, u should probably post some more codes up. Ted Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-713076 Share on other sites More sharing options...
kabucek Posted December 11, 2008 Author Share Posted December 11, 2008 this is strange, because when i use the same file for expired events its working ok and when I create new event with similar data and try to register for it its working ok too. hmm.. what more code do you want? Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-713079 Share on other sites More sharing options...
trq Posted December 11, 2008 Share Posted December 11, 2008 what more code do you want? Again we ask. Can we see how this array is created? Sheesh. Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-713081 Share on other sites More sharing options...
kabucek Posted December 11, 2008 Author Share Posted December 11, 2008 foreach ($eventPeriodListArray as $label => $periodArray) { if ($allowedDaysArray[$periodArray['myeventDayNumber']]=='true') { $availablePeriodListArray[$inx]=$periodArray; $inx++; } } $eventPeriodListArray=$availablePeriodListArray; $tmpPeriodArray=$seminarPeriodListArray; var_dump($tmpPeriodArray); foreach ($tmpPeriodArray as $label=> $itemArray) { //init $eventID=$eventRecordArray['itemID']; $eventPeriodID=$itemArray['itemID']; //format out the period TIME display $dayName=dayNameFromevent($itemArray['eventDayNumber']); $startTime=date("h:i a", $itemArray['scheduleStartSecond']+$timeOffset); $endTime=date("h:i a", $itemArray['scheduleEndSecond']+$timeOffset); $seminarPeriodListArray[$label]['showTime']=" $dayName $startTime - $endTime "; is this helpful ? there is more than 10,000 lines of code so if you tell me which section you want i will post it thanks again for help !! Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-713088 Share on other sites More sharing options...
trq Posted December 11, 2008 Share Posted December 11, 2008 is this helpful ? Not really. Now we need to know how $seminarPeriodListArray is created. Seriously, you need someone who knows php to take a look at the code. And I don't just meen post the lot on a forum. If your unable to narrow the problem down were just going to go around in circles. ps: 10000 lines of code in one file doesn't say much for this applications design. I should imagine this might be a bit of a nightmare to debug. Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-713095 Share on other sites More sharing options...
kabucek Posted December 11, 2008 Author Share Posted December 11, 2008 foreach ($seminarPeriodListArray as $label => $periodArray) { if ($allowedDaysArray[$periodArray['maniaDayNumber']]=='true') { $availablePeriodListArray[$inx]=$periodArray; $inx++; } } $seminarPeriodListArray=$availablePeriodListArray; thanks for help Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-713106 Share on other sites More sharing options...
trq Posted December 11, 2008 Share Posted December 11, 2008 That really doesn't help at all still. We need to see the different arrays creation within context of the script. Quote Link to comment https://forums.phpfreaks.com/topic/136531-foreach-function-error/#findComment-713120 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.