I have the following select:
public function SelectLastError(){
try {
$stmt = $this->conn->prepare("SELECT Name, Data FROM Errors ORDER BY ErrorsId DESC LIMIT 3");
$stmt->execute();
while ($row = $stmt->fetch( PDO::FETCH_ASSOC )){
$rows[] = $row;
}
}catch (PDOException $exception){
echo $exception->getMessage();
echo "Error!";
return null;
}
}
And I'm trying to call it HTML like this:
<?php
$rows = $selectors->SelectLastError();
foreach ($rows as $row):?>
<a href="" class="list-group-item">
<i class="fa fa-bug"></i><?php echo $row['Name'];?>
<span class="pull-right text-muted small"><em><?php echo $row['Data']?></em>
</span>
</a>
<?php endforeach; ?>
I've done this same idea in another foreach, I do not know why this error is appearing, SELECT is right, I've already tested it. Anyone have any ideas?