diff --git a/database.php b/database.php index 1c762cb..27fb167 100644 --- a/database.php +++ b/database.php @@ -1332,10 +1332,11 @@ class Database $search_query = str_ireplace (' ', '%', $search_query); $query = $this->database->prepare ( - 'SELECT * ' . - 'FROM `post`' . - 'WHERE `title` LIKE ? ' . - 'ORDER BY `created`' . + 'SELECT P.*, U.`username` ' . + 'FROM `post` AS P ' . + 'JOIN `user` AS U ON P.`userId` = U.`id`' . + 'WHERE P.`title` LIKE ? ' . + 'ORDER BY P.`created` DESC ' . 'LIMIT 100'); $query->execute (['%' . $search_query . '%']);