Hi Everyone, I have been trying to find out what the problem is with this foreach but I am unable to...
Is there anyone who can me please

            foreach($results as $row);
                $dbcansecurecode = $row['securecode'];
                $dbcanactivated = $row['activated'];
                $dbcanpwdreset = $row['pwdreset'];

I have echo'd the results out for the foreach but I am still getting the error message -
Invalid argument supplied for foreach()

Recommended Answers

All 2 Replies

I wonder if that rogue semicolon one line 1 has anything to do with it. ;) My recommendation in general is to always use braces around a compound statement to avoid this and the next related error you're sure to encounter just by deleting that semicolon.

Sorted this problem now, the issue was with the

        $row  = $STM -> fetchAll();

I was only doing

        $row  = $STM -> fetch();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.