The php/html file I am working on is laid out in this way.
<?php
// connect to DB $connection
?>
html
html
html
<?php
foreach($connection-query($sql) as $row)
do stuff
?>
I'm getting the error 'Invalid argument supplied for foreach()' when I run this page. Can I not break out of the php and go into html and then come back to my php using the $connection variable created in the upper php code? Or once I break out with ?>
is that it, all variable can not be picked back up again futher down in the page?
I can't think of another reason because I have used that exact foreach loop in another file and it worked fine.