SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    foreach function error

    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

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Unlikely.

    Verify that the information is an array where it should be. You may need to look into the processTemplateArray function and run checks on the data from within that.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Use var_dump($processTemplateArray) and var_dump($classSelectionArray), to find out what they really are.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    where to put var_dump ? after the foreach or before?

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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?

  6. #6
    SitePoint Zealot j3ph's Avatar
    Join Date
    Jan 2006
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do what arkinstall said and put var_dump($classSelectionArray) before the foreach(). That will tell you what datatype $classSelectionArray really is and what value(s) it holds.

    Then you can follow the trail backwards.

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i did that and there is "NULL" right before the error message.
    any suggestions now?
    thanks

  8. #8
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your variables aren't arrays. A foreach loop requires an array. You're going to have to post a whole LOT (a whole LOT) more code if we're going to help you beyond that.

  9. #9
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok but this file has more than 10,000 lines.
    give me suggestions for which section you want
    and i will post it

    thanks !!

  10. #10
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    anything to do with the problem.

    Thats the relevent variable declarations, anything effecting them etc.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  11. #11
    SitePoint Enthusiast
    Join Date
    Aug 2006
    Posts
    86
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think i will call 1-800-phphelp ..lol


    thanks for help



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •