1
My 'listing.php' page loops infinitely when displaying values.
I used a while
to display all database values
The PHP code used in the page php listing.
<?php while($row = $resultado):?>
<tr>
<td><?php echo $row->ID; ?></td>
<td><?php echo $row->courseName; ?> </td>
<td><?php echo $row->name; ?> </td>
<td><?php echo $row->date; ?> </td>
<td><?php echo $row->comment; ?></td>
</tr>
<?php endwhile;?>
The function with the Query is written like this:
function selectAll(){
$this->connect();
$resultSet = $this->pdo->query("SELECT comment.ID, courseName, name, date, comment FROM comment, course, teacher WHERE teacher.idCourse = course.ID AND comment.idTeacher = teacher.ID;");
return $resultSet->fetch(PDO::FETCH_OBJ);
}
Ever tried to make a
foreach
? foreach ($result as $Row)– Ikaro Sales
Not yet, I’ll try here and see if I can.
– Wellington Albertoni