我试图通过使用以下查询来获取mysql数据库的用户详细信息
$rows=array();
$query = "SELECT CONCAT(usrFirstname,'',usrSurname) As FullName,usrNickname AS Nickname,";
$query.= "usrEmail As EmailAddress,usrGender AS Gender,DATE_FORMAT(usrDOB,'%d%m%y') As DOB,usrBelt AS BeltId";
$query.= "FROM user";
$result = mysql_query($query);
echo mysql_error();
if($result)
{
while($row=mysql_fetch_assoc($result))
{
$rows[] = $row;
}
}
它给出了这样的错误
错误: 您的SQL语法有错误;查看与MySQL服务器版本对应的手册,以便在第1行的“用户”附近使用正确的语法
答案 0 :(得分:1)
尝试在from
之前添加空格$query.= " FROM user";
答案 1 :(得分:0)
usrBelt AS BeltId
和FROM
之间没有空格。
答案 2 :(得分:0)
您在单词FROM
前面缺少空格。
$query.= "usrEmail As EmailAddress,usrGender AS Gender,DATE_FORMAT(usrDOB,'%d%m%y') As DOB,usrBelt AS BeltId";
$query.= " FROM user";