Forum Moderators: coopster
So here is what I am doing:
$result = $dbconn->query("select * from tablename");
while($case = fetch_array_html($result))
Here is the function:
function fetch_array_html($result)
{
$arr = mysql_fetch_array($result);
foreach($arr as $key=>$val)
{
$arr[$key] = htmlentities($val);
}
return $arr;
}
Here is the error I get:
Warning: Invalid argument supplied for foreach() on line 129
What exactly am I doing wrong here? I can usually fix my own errors, but this one is dominating me.
Any help is greatly appreciated. Thank you.
function fetch_array_html($result) {
if ($arr = mysql_fetch_array($result)) {
foreach($arr as $key=>$val) $arr[$key] = htmlentities($val);
return $arr;
}
}