Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Model
- public static function findById($id)
- {
- $db = new Db();
- $sql = 'SELECT * FROM ' . static::TABLE . ' WHERE `id` = :id';
- return $db->query($sql, static::class, [':id' => $id])[0] ?? false;
- }
- http://php-2/DZ-1/article.php?id=not found
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Моя новость </title>
- </head>
- <body>
- <h1><?php echo $article->title; ?></h1>
- <p><?php echo $article->content; ?></p>
- </body>
- </html>
- Notice: Trying to get property 'title' of non-object in
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement