[英]how to select records with join in table in PHP
我需要选择已登录的茶(老师)的记录我对此进行了大量研究,但遇到了很多难题,所以我真的希望您对此有所帮助,非常感谢!
这是我的代码:
$query=mysqli_query($conn, "select * from `app` left join `par` on par.par_id=app.par_id
left join `tea` on tea.tea_id=app.tea_id
ORDER BY app_id DESC");
您的条件语法错误
select * from app
left join par on par.par_id=app.par_id
left join tea on tea.tea_id=app.tea_id
where tea.tea_id = '".$_SESSION['tea_id']."' ORDER BY app_id DESC
您的where子句需要说出您匹配的列
$query=mysqli_query($conn, "select *
from app
left join par on par.par_id=app.par_id
left join tea on tea.tea_id=app.tea_id
where tea.tea_id = '".$_SESSION['tea_id']."'
ORDER BY app_id DESC");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.