php 数据库状态[42000]:语法或访问冲突:1064您SQL语法中有错误

3ks5zfa0  于 2022-12-02  发布在  PHP
关注(0)|答案(1)|浏览(122)

我试图运行一个SQL查询,但它给这个错误,我有保留列在商店表和保留表,其中有名字,姓氏或电子邮件:

"SQLSTATE[42000]: Syntax or access violation: 1064 you have an error in your SQL syntax;

 'FROM 
  reservations R
  LEFT JOIN 
 'at line 11"

密码:

public function getReservationData($store = null, $limit = 10, $offset = 1)

  {
      $em = $this->getEntityManager();
      $offset = ($offset -1) * $limit;
      $query = "SELECT
                    R.FirstName as firstName,
                    R.LastName as lastName,
                    R.Email as email,
                FROM reservaions R
                LEFT JOIN 
                    stores S
                       ON s.id = R.store
                WHERE
                    s.id = :store
                AND
                     S.reservation = 1";

                 $stmt->$this->getEntityManager()->getConnection->prepare($query);
                 $stmt->$bindParam(':store', $store);
                 $stmt->execute();
                 $result[] = $stmt->fetch();

                 return $result;
  }
b1zrtrql

b1zrtrql1#

R.Email as email,

请删除“”,这样就可以解决问题

相关问题