Syntax error, unexpected '
I am getting the following error. I am trying to add data to database.
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in localhostsiteadminadd.php on line 16
Here is my code:
<?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/69446.html
上一篇: 我的代码在这里有什么问题吗?
下一篇: 语法错误,意外的'