我想知道原因
$amzius_sql = "SELECT DISTINCT `Age` , SUBSTRING( Age, LOCATE( ' ', Age ) ) AS `AgePrefix` , SUBSTRING_INDEX( Age, ' ', 1 ) AS `AgeValue` FROM `suoPage` ORDER BY `AgePrefix` , `AgeValue` LIMIT 0 , 30";
$amzius_res = mysql_query($amzius_sql);
完美无瑕地工作,并且:
$amzius_sql = 'SELECT DISTINCT `Age` , SUBSTRING( Age, LOCATE( " ", Age ) ) AS `AgePrefix` , SUBSTRING_INDEX( Age, " ", 1 ) AS `AgeValue` FROM `suoPage` ORDER BY `AgePrefix` , `AgeValue` LIMIT 0 , 30';
$amzius_res = mysql_query($amzius_sql);
产生错误: '字段列表'中的未知列''
唯一的区别是报价。如果在phpMyAdmin中查询了两个查询 - 两者都有效,但只有第一个查询可以在PHP中使用mysql_query()进行查询
答案 0 :(得分:2)