当我查询的数据只有一条时就出现以下问题

来源:6-4 [PDO实战] 功能实现之用户登录

智商不够_熬夜来凑

2017-07-14 07:58

SQLSTATE: 42000 
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Error SQL:SELECT * FROM userinfo WHERE userId=�

SQLSTATE: 42000 
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Error SQL:SELECT * FROM user WHERE userId=�

SQLSTATE: 42000 
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Error SQL:SELECT * FROM userinfo WHERE userId=�

SQLSTATE: 42000 
SQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Error SQL:SELECT * FROM user WHERE userId=�


写回答 关注

1回答

  • 野人营
    2017-09-12 16:00:24

    SQL语句有问题,最大的可能原因就是最后的userId后面的字段格式和内容。

PDO—数据库抽象层

本教程主要通过实战演练深入剖析PDO以加深理解

30043 学习 · 396 问题

查看课程

相似问题