语法错误,意外的'

我收到以下错误。 我正在尝试将数据添加到数据库。

第16行解析错误:语法错误,意外的' - >'(T_OBJECT_OPERATOR)在localhost site admin add.php中

这是我的代码:

<?php

session_start();

include_once('../includes/connection.php');

if (isset($_SESSION['logged_in'])) {
 if (isset($_POST['title'], $_POST['content'])) {
 $title = $_POST['title'];
 $content = nl2br($_POST['content']);

       if (empty($title) or empty($content)) {
       $error = 'All fields are required!';

       } else {
         $query = pdo->prepare('INSERT INTO articles (article_title, article_content, article_timestamp) VALUES (?, ?, ?)');

         $query->bindValue(1, $title);
         $query->bindValue(2, $content);
         $query->bindValue(3, $timestamp);
         $query->bindValue(4, $image);
         $query->bindValue(5, $demo);

         $query->execute();

         header('Location: index.php');

       }
}

} else {
   header('Location: index.php')
   }
?>

这是问题

header('Location: index.php');
链接地址: http://www.djcxy.com/p/69445.html

上一篇: Syntax error, unexpected '

下一篇: syntax error, unexpected T