I'm adding the result of a query to an array and I'm trying to serialize to Json . I am not able to print my JSON correctly, could you help me?
My code:
<?php
ini_set('max_execution_time', 123456);
$conn = oci_connect('teste', 'teste123', '192.168.90.3/teste');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$query = oci_parse($conn, 'SELECT NR_SEQUENCIA, DS_GRUPO_TRABALHO FROM man_grupo_trabalho');
oci_execute($query);
$rows = array();
while($r = oci_fetch_assoc($query)) {
$rows[] = $r;
}
$locations =(json_encode($rows));
echo $locations;
?>
But it is generating the error:
Warning: oci_connect (): in C: \ xampp \ htdocs \ billing \ connection.php on line 5
Fatal error: in C: \ xampp \ htdocs \ billing \ connection.php on line 9