Error message in display records from database...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nma
    New Member
    • Aug 2007
    • 93

    Error message in display records from database...

    Hi

    I want to display list from my database, but output shows this error message

    Code:
    "Warning: Invalid argument supplied for foreach() in C:\..\aa.php on line 60"
    in line 60 at aa.php is this :
    [code=php]
    foreach($allFra mes as $frame)[/code]

    What is wrong with this code?

    thanks
    Last edited by pbmods; Sep 18 '07, 10:58 PM. Reason: Fixed CODE tags.
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    At first sight nothing wrong, BUT show us some of your code so we can see what the variables really are (e.g. an array). And put your code within code tags!

    Ronald

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, NMA.

      I love how you put the PHP error message in PHP tags, but then DIDN'T use PHP tags for the actual source code.

      Please use CODE tags when posting source code:

      [CODE=ph p]
      PHP code goes here.
      [/CODE]

      Comment

      • kovik
        Recognized Expert Top Contributor
        • Jun 2007
        • 1044

        #4
        Obviously, $allFrames is not an array or an object. You should always check beforehand with is_array(), is_object(), or !is_scalar() unless you are *absolutely*sur e* that the variable can be iterated through.

        Comment

        Working...