2013-12-22 33 views
0

查询=0行上的字符串搜索

SELECT * FROM options WHERE 'key' = 'exchange_rate' 

表结构中返回=

key varchar(500) latin1_swedish_ci 
value text latin1_swedish_ci 

表内容

Key   | Value 
exchange_rate | 25 

方案

phpMyAdmin 4.0.4 Mysql 

结果

0 Rows returned 

你知道问题在这里吗?

回答

2

尝试此查询:代替

SELECT * FROM options WHERE `key` = 'exchange_rate' 

SELECT * FROM options WHERE 'key' = 'exchange_rate' 
+0

'key'是[保留字] (http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html)。使用反引号。 – Styxxy

+0

@Styxxy谢谢,它完成了 –

0

Qoutes用于显示VARCHAR值不列名

SELECT * FROM options WHERE `key` = 'exchange_rate'