I have the following statement in some code:
foreach ($rfields as $value) { echo "$value, "; }
This statement returns the values of my $rfields array separated by commas as expected. However, if I put this statement into the function below:
function tom() {
foreach ($rfields as $value) { echo "$value, "; }
}
But, when I call the function, I get an error: "Warning: Invalid argument supplied for foreach() in db.php on line 151"
Why would this work outside the function, but not inside the function? How can I fix it so that the function will print the values of the array separated by commas?