-1
I’m trying to make a query however, although the query works well in Phpmyadmin in the browser returns the message below:
Fatal error : Call to Undefined method Pdostatement::fetch_array() in D: xampp htdocs final inc projecao.php on line 73
My code is like this:
$sql = BD::conn()->prepare("SELECT
sjy_empresas.nick,
pe_orclinhas.dc,
pe_orcgrupos.grupo_orcamento,
pe_orclinhas.orclinha,
pe_orclinhas.id_orclinha,
pe_premorc.exercicio,
pe_premorc.emp,
pe_premorc.anterior,
pe_premorc.prj
FROM sjy_empresas
INNER JOIN pe_orcgrupos
INNER JOIN pe_orclinhas ON pe_orcgrupos.id_orca = pe_orclinhas.orcgrupo
INNER JOIN pe_premorc ON pe_orclinhas.id_orclinha = pe_premorc.linhabud
AND sjy_empresas.id_empresa = pe_premorc.emp
WHERE pe_premorc.emp = ?
AND pe_premorc.exercicio = ?
AND pe_orclinhas.id_orclinha = ?");
$sql->execute(array($emp, $exercicio, $ans));
$dt = $sql->fetch();
$nick = $dt('nick'); // Essa é a linha 75
You’ve already given one
var_dump($dt)
???– novic
Yes, and the fields are coming normally. Only as string: array(9) { ["nick"]=> string(14) "Example TOY SP" ["dc"]=> string(1) "X" ["group_budget"]=> string(9) "Show Room" ["orclinha"]=> string(5) "Etios" ["id_orclinha"]=> string(3) "460" ["exercicio"]=> string(4) "2018" ["emp"]=> string(1) "4" ["previous"]=> string(4) "0.00" ["prj"]=> string(4) "0.00" }
– Webster Moitinho
So it is
$dt['nick']
got it?– novic
Oops!!! I understood yes. Thank you
– Webster Moitinho