开发者

mysql query error in php

When I try execute query in mysql console - it's execute succesful, but in php it doesn't work. In php return error: Unknown column 'users.pwd' in 'field list'

Query:

 SELECT users.`login`, 
        users.`name`, 
        users.`pwd`, 
        users.`grp`, 
        us开发者_运维知识库ers.`email`, 
        users.`status`, 
        users.`lang_id`, 
        users.`tmst`, 
        users.`id`
     FROM 
        users
      WHERE users.`pwd` = '5d872b11ff7916c18052c6a4e50e8558' 
     AND 
        users.`login` = 'admin'   


Try the query without the user word, it's not need when you select columns from a single table.

SELECT `login`, 
        `name`, 
        `pwd`, 
        `grp`, 
        `email`, 
        `status`, 
        `lang_id`, 
        `tmst`, 
        `id`
FROM `users` WHERE `pwd`='5d872b11ff7916c18052c6a4e50e8558' AND `login`='admin'

Or use:

SELECT * FROM `users` WHERE `pwd`='5d872b11ff7916c18052c6a4e50e8558' AND `login`='admin'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜