无法在数据库中上传线程

时间:2019-05-15 12:09:22

标签: php

我正在为论坛工作,但是无法使用PDO将线程上传到数据库中

我的代码以前可以工作,但是我将数据库列表从forum_inhoud更改为用户。

if(isset($_POST['add_thread'])){
$id = $_SESSION["id"];
$title = $_POST['title'];
// $photo = $_POST['photo'];
$content = $_POST['content'];

if(dbConnect()) {
    dbQuery(
        "SELECT * FROM threads 
            WHERE title = :title,
            content = :content
            AND users_id = :id", 
        [':title' => $title,
         ':content' => $content,
         ':id' => $id
         ]
    );

    dbQuery(
        "INSERT INTO threads(title, content, users_id) VALUES (:title, :content, :id)",
        [
            ':title'=> $title,
            ':content' => $content,
            ':id' =>  $id
        ]
    );

    header('Location: ../../threads.php');
    exit(0);
}

}

 <?php
  include_once('app/helpers/db.php');

  if(dbConnect()){
         dbQuery("SELECT threads.*, 
             forum_inhoud.users 
         FROM threads 
         INNER JOIN forum_inhoud ON threads.forum_inhoud_id = 
         forum_inhoud.id");

  dbQuery("SELECT threads.*, 
        users.username
    FROM threads 
    INNER JOIN users ON threads.users_id = users.id");

  $threads = dbGetAll();

  }
  ?>

我希望你们能帮助我,我认为问题出在数据库查询中

0 个答案:

没有答案