thinkphp5 You have an error in your SQL syntax; check the manual that corresponds to your MySQL s

分析报错原因:

php sql 语句规定表名,字段名应该是用 ` (键盘上数字一行最左侧的一个)  而不是单引号

下面是实例:

错误的实例:

$front=db('photo')->where('id>'.$photoid)->limit(1)->order('id','asc')->find();

正确的实例:

$front=db('photo')->where(`id>`.$photoid)->limit(1)->order(`id`,'asc')->find();

猜你喜欢

转载自blog.csdn.net/qq_40270754/article/details/87882159