Welcome Guest, Not a member yet? Register   Sign In
CI foreach error
#1

[eluser]Unknown[/eluser]
I get a error when i read Professional CodeIgntier from Wrox press. Check it our the below code
Code:
if(count($navlist)){
echo "<ul>";
foreach($navlist as $key=>$list){
  foreach($list as $topkey=>$toplist){
   echo "<li class='cat'>";
   echo anchor("welcome/cat/$topkey",$toplist['name']);
   echo "</li>\n";
   if(count($toplist['children'])){
    foreach($toplist['children'] as $subkey=>$subname){
     echo "\n<li class='subcat'>";
     echo anchor("welcome/cat/$subkey",$subname);
     echo "</li>";
    }
   }
  }
}
echo "</ul>";
}

When i run i get this error A PHP Error was encountered

Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: views/navigation.php
Line Number: 5

how can i solve it? :?




Theme © iAndrew 2016 - Forum software by © MyBB