$sql= 'select employee.id AS ID,CONCAT(employee.fname," ",employee.lname) AS Name, IF(loan.status= "unpaid",loan.installment,0) AS Loan where employee.user = "$name"';
这不会显示表格的结果。因为此查询显示不匹配。我想把" $ name"双引号是错误。
$sql= "select employee.id AS ID,CONCAT(employee.fname," ",employee.lname) AS Name, IF(loan.status= 'unpaid',loan.installment,0) AS Loan where employee.user = '$name'"
在这种情况下,将“未付”'单引号中没有显示此列的结果
我试过了 employee.user =''' $名称''' employee.user ="' $ name'" 这些工作都没有..请帮忙答案 0 :(得分:0)
引号序列似乎正确但是 你错过了从句子
$sql= "select employee.id AS ID,CONCAT(employee.fname, ' ' ,employee.lname) AS Name,
IF(loan.status = 'unpaid',loan.installment,0) AS Loan
FROM employee
INNER JOIN loan on loan.your_key1 = employee.your_key2
where employee.user = '$name'";
您必须为your_key1指定正确的列名,为JOIN指定your_key2