Hi
I have the a foreach loop in my code, but i'm getting "Invalid argument supplied for foreach()" error.
At the beginning of the file i have these two lines:
And later on i have these lines:
The Countries.php file in the classes folder just reads data from a countries table in a database.
What could be wrong here?
/Peter
I have the a foreach loop in my code, but i'm getting "Invalid argument supplied for foreach()" error.
At the beginning of the file i have these two lines:
Code:
require_once("classes/Countries.php");
$countries = new Countries;
And later on i have these lines:
Code:
if (! isset($_GET['nocountries'])) {
foreach ($countries as $c => $value) {
echo "<a href=\"start.php?country=$c->iso2\">\n";
echo "<img src=\"$c->picfile\" alt=\"$c->name\" title=\"$c->name\" style=\"border:0\" />\n";
echo "</a>\n";
}
}
The Countries.php file in the classes folder just reads data from a countries table in a database.
What could be wrong here?
/Peter