mysql_result返回归档的名称作为结果

时间:2013-03-01 20:31:35

标签: mysql sql

我在网络编程方面有点新意。我只研究了一年左右。

我的问题如下。出于某种原因,当我使用此查询时(在phpadmin wampserver中),最后4个字段结果是字段名称。

SELECT  `latin_name` ,  
    `group` ,  
    `name` ,  
    `continent` , 
    `country` ,  
    `position` ,  
    `hight_min` ,  
    `hight_max` ,  
    `light_min` ,  
    `light_max` ,  
    `temp_min` ,  
    `temp_max` ,  
    `nk_min` ,  
    `nk_max` ,  
    `gh_min` ,  
    `gh_max` ,  
    `ph_min` ,  
    `ph_max` ,  
    `growth_rate` ,  
    'growth_min',  
    'growth_max', 
    'gfactor',  
    'period' 
FROM  `plants` 
WHERE continent LIKE  'As' 
    AND growth_rate LIKE  'slow' 
LIMIT 0 , 30

可能是什么问题?

2 个答案:

答案 0 :(得分:4)

您似乎混合了报价类型。前几个字段使用`,但最后四个字段使用',这会将它们转换为字符串文字。

尝试:

SELECT  `latin_name` ,  
`group` ,  
`name` ,  
`continent` , 
`country` ,  
`position` ,  
`hight_min` ,  
`hight_max` ,  
`light_min` ,  
`light_max` ,  
`temp_min` ,  
`temp_max` ,  
`nk_min` ,  
`nk_max` ,  
`gh_min` ,  
`gh_max` ,  
`ph_min` ,  
`ph_max` ,  
`growth_rate` ,  
`growth_min`,  
`growth_max`, 
`gfactor`,  
`period` 
FROM  `plants` 
WHERE continent LIKE  'As' 
AND growth_rate LIKE  'slow' 
LIMIT 0 , 30

答案 1 :(得分:2)

对于最后4个字段,您有撇号(')而不是反叛(`)。