我正在尝试使用select选项框对表数据进行排序,该选项框也从数据库中获取选项。所以基本上如果我选择期权主席,它应该填充表格与竞争主席位置的候选人。但是我遇到了问题,因为sql语法似乎不正确。请帮忙
<?php
if(!empty($_POST['sort'])) {
$sql1=" SELECT tbpositions.position_id, tbcandidates.candidate_name, tbcandidates.candidate_position FROM tbpositions
INNER JOIN tbcandidates ON
tbpositions.position_id=tbcandidates.position_id WHERE ($row['position_name']==$_POST[$position_name])";
$result = mysqli_query($con, $sql1);
$count = mysqli_num_rows($result);
}
?>