MySQL Query works in Workbench but not in php script

0

I did a search on this problem, I found several with similar situation and, nevertheless, the problems were others. I have the following code where the query, if it is executed in the console, MySQL Workbench or phpmyadmin works perfectly. In the case, I checked the connection with the database and everything is correct, since from modifying the query to another very simple, the script works correctly and brings the expected result. But with this query, the browser returns nothing, just a blank page. NOTE: Error messages are enabled in php.ini. Thanks!

<?php
require_once "conn.php";

$dbconnecta = mysqli_connect($server, $user, $pass);
if(!$dbconnecta) {
  die("Not connected: ". mysqli_error());
}else{
    mysqli_select_db($dbconnecta, $dba);
}

$query = "SELECT
n.nid,
a.field_dc_autores_nid,
n.title as titulo,
s.title as autor,
filename,
field_dublincore_source_value,
field_ano_da_publica_o_value,
art.name,
ed.name
FROM
node n
INNER JOIN
field_data_field_dc_autores a
ON a.entity_id = n.nid
AND n.type = 'conteudo'
INNER JOIN node s
ON a.field_dc_autores_nid = s.nid
AND s.type = 'autor'
INNER JOIN field_data_field_arquivo ar
ON ar.entity_id = n.nid
INNER JOIN file_managed
ON fid = field_arquivo_fid
INNER JOIN field_data_field_dublincore_source f
ON f.entity_id = n.nid
INNER JOIN ensp_producaocientifica.field_data_field_ano_da_publica_o ano
ON ano.entity_id = n.nid
INNER JOIN ensp_producaocientifica.field_data_field_grupo_da_producao_bibli
ON field_data_field_grupo_da_producao_bibli.entity_id = n.nid
INNER JOIN taxonomy_term_data art
ON tid = field_grupo_da_producao_bibli_tid
INNER JOIN field_data_field_dublincore_publisher pub
ON pub.entity_id = n.nid
INNER JOIN taxonomy_term_data ed
ON ed.tid = field_dublincore_publisher_tid
WHERE n.type = 'conteudo'
AND art.name like 'Artigos completos publicados em periódicos'
AND n.status = 1
AND n.nid = 369751
ORDER BY
nid DESC,
a.delta ASC
";
$dbresult = mysqli_query($dbconnecta, $query);
  while ($row = mysqli_fetch_array($dbresult)) {
  echo $row['titulo'] . "<br>";
 echo $row['field_ano_da_publica_o_value'];
}
    
asked by anonymous 23.08.2016 / 19:33

0 answers