Se for necessariamente fetch_object
Coloca um var_dump na variável $rows e posta pra gente ver o conteúdo dela...
André obrigado pela ajuda coloquei var_dump como você pediu utilizando fetch_object e fetch_row e deu as seguintes mensagens...
$sql = "SELECT SUM(quantidade) as SOMA, material FROM est_item_req GROUP BY material";
$consulta = pg_query($conexao,$sql);
while ($rows = pg_fetch_object($consulta)){
$pdf->SetX(6);
var_dump ($rows);
$material=$rows->material;
$total=$rows->SOMA;
$pdf->Cell(100,4,$material,0,0,'L',$fill);
$pdf->Cell(98,4,$total,0,1,'L',$fill);
}
object(stdClass)#3 (2) { ["total"]=> string(1) "1" ["material"]=> string(2) "33" } Notice: Undefined property: stdClass::$TOTAL in /var/www/rels/requisicoes.php on line 162 object(stdClass)#6 (2) { ["total"]=> string(2) "11" ["material"]=> string(2) "35" } Notice: Undefined property: stdClass::$TOTAL in /var/www/rels/requisicoes.php on line 162
$sql = "SELECT SUM(quantidade) as SOMA, material FROM est_item_req GROUP BY material";
$consulta = pg_query($conexao,$sql);
while ($rows = pg_fetch_row($consulta)){
$pdf->SetX(6);
var_dump ($rows);
$material=$rows->material;
$total=$rows->SOMA;
$pdf->Cell(100,4,$material,0,0,'L',$fill);
$pdf->Cell(98,4,$total,0,1,'L',$fill);
}
array(2) { [0]=> string(1) "1" [1]=> string(2) "33" } Notice: Trying to get property of non-object in /var/www/rels/requisicoes.php on line 161 Notice: Trying to get property of non-object in /var/www/rels/requisicoes.php on line 162 array(2) { [0]=> string(2) "11" [1]=> string(2) "35" } Notice: Trying to get property of non-object in /var/www/rels/requisicoes.php on line 161 Notice: Trying to get property of non-object in /var/www/rels/requisicoes.php on line 162
Quero agradecer também a todos os amigos que estão tentando ajudar...LeoB, Fábio Web Arts.
Obrigado a todos!!