Good morning, my problem is this, Php sends me the following Warning
Warning: utf8_decode () expects parameter 1 to be string, object given in.
I have already reviewed my code and I have declared the characterSet in this mode "CharacterSet" => "UTF-8"
If I delete it, it does not produce results, the part of the code where the error is thrown is the following
<?php
//imprime resultados codificados a utf8 en caso de no haber resultados no hace nada
if($hay){
while($result = sqlsrv_fetch_object($results)) {
echo "<tr>";
foreach ($result as $col) {
echo "<td>". utf8_decode($col) ."</td>";
}
echo "</tr>";
}
}
?>
All after a query that gives me partial results, now I checked, I did var_dump
and I got the gettype
of $col
and I realized (as in the query includes a field type Datatime) that the date is the one that somehow does not convert and causes this warning, printing almost all data except the date.
Will anyone know what I can do to resolve the warning?