2013-12-22 71 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'