0
The code only returns me the first row of the table referring to the patient ID
<?php
require 'conexao.php';
// Recebe o id do exame do exame via GET
$id_exames = (isset($_GET['id'])) ? $_GET['id'] : '';
// Valida se existe um id e se ele é numérico
if (!empty($id_exames) && is_numeric($id_exames)):
// Captura os dados do exame solicitado
$conexao = conexao::getInstance();
$sql = 'SELECT id,codigo,data,exame,data2 FROM historico where id='.$id_exames;
$stm = $conexao->prepare($sql);
$stm->bindValue(':id', $id_exames);
$stm->execute();
$exames = $stm->fetch(PDO::FETCH_OBJ);
endif;
?>
I didn’t understand. Put the sql of the code and if possible speak like this your table in the database. To make it easier to help you...
– LocalHost
The function of
PDO
fetch
list only one element, to list all that return in the query, you must use:fetchAll
– MarceloBoni