0
Hello, I’m migrating from Mysql to PDO and I’m having difficulty putting in a table two selects.
try{
$CON = new PDO("mysql:host=localhost;dbname=tcc", 'root', '1234');
}
catch (PDOException $e)
{
echo "Erro : ".$e->getMessage();
}
$select = "select * from MATERIA";
$resultado = $CON->query($select);
$select2 = "select * from ALUNO";
$resultado2 = $CON->query($select2);
while($row = $resultado->fetch(PDO::FETCH_BOTH) and $row2=$resultado2->fetch(PDO::FETCH_BOTH)){
echo "<tr><td>".$row['NOME']."</td><td>".$row2['NOME']."</td>";
}
The problem is, when the results of query 1 are over, he stops listing the other students, and I’d like him to continue writing them.
It doesn’t make much sense what you did. What is your goal?
– Woss
I need to list in a table where the first column are registered students and in the second the subjects registered in the bank.
– Gabriel Rodrigues