Обработка ошибок

This commit is contained in:
Igor Barkov (iwork) 2020-07-22 12:27:05 +03:00
parent 0bb76777eb
commit 7c7e4295e9
1 changed files with 8 additions and 1 deletions

View File

@ -11,7 +11,14 @@ class PresentsModel
public function __construct(int $user_id)
{
$this->DB = db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
if (!$this->DB) {
try {
$this->DB = db::c()->query('SELECT sender_id, image FROM `users_presents` WHERE owner_id = ?i', $user_id);
} catch (Exception $e) {
echo "Такого пользователя не существует!";
}
}
}
public function getAllPresents()