Now they aren't working anymore, but before they were
function perm1($conn)
{
$stmt = odbc_prepare($conn, 'SELECT * FROM nivel_acesso');
$success = odbc_execute($stmt);
echo "erro 1";
echo '<ul class="perm">';
echo "erro 2";
while($myRow = odbc_fetch_array($stmt))
{
echo "erro 3";
$rows = $myRow;
echo '<li>';
echo "erro 4";
echo'<input type="checkbox" name="perm'.$rows["nivel"].'" value="'.$rows["nivel"].'"><label for="perm'.$rows["nivel"].'">'.mb_convert_encoding($rows["descricao"], 'utf8', 'latin1').'</label>';
echo '</li>';
echo "erro 5";
}
echo "erro 6";
echo '</ul>';
echo "erro 7";
if(empty($rows))
{
echo "erro 8";
return $nada = "macacos";
echo "erro 9";
}
echo "erro 10";
return $rows;
}
That's my function to show a group of checkboxes with a list of permissions from my database, the query is fine and the connection to.
function utf8_converter($array){
array_walk_recursive($array, function(&$item, $key){
if(!mb_detect_encoding($item, 'utf-8', true)){
$item = utf8_encode($item);
}
});
return $array;
}
That's my function that I use to get the utf-8 of the inputs I get from the database.
When I use something like utf8_converter(perm1($conn))
it gives me this error:
Warning: array_walk_recursive() expects parameter 1 to be array, string given in [Directory of the file here + file name].php on line 35
Line 35 is:
function utf8_converter($array){
array_walk_recursive($array, function(&$item, $key){
if(!mb_detect_encoding($item, 'utf-8', true)){
$item = utf8_encode($item);
}
});<--This one here
return $array;
}