16 lines
343 B
PHP
16 lines
343 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
function retrieve_chat_history(object $pdo){
|
|
$query = "SELECT username, content, date_sent FROM comments WHERE visible=true;";
|
|
|
|
$stmt = $pdo->prepare($query);
|
|
$stmt->execute();
|
|
$chat_history = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
$stmt = null;
|
|
$query = null;
|
|
|
|
return $chat_history;
|
|
} |