我正在尝试传递一个查询值,该查询从早期的Sql查询中获取一个变量,然后将结果与另一个表中的字段进行比较。但我似乎无法弄清楚我的语法。
$topName = $row_rsAdminDetails['fullName'] ;
$TESTqueryTwo =
"SELECT * FROM participants, admin WHERE admin.over_id = participants.fk_over_id AND participants.dr_over_names LIKE '%$topName%'";
$TESTresult2 = mysql_query($TESTqueryTwo) or die(mysql_error());
我想要的PHP输出:
<?php
// Print out the contents of each row
while($row_TESTresultTwo = mysql_fetch_array($TESTresultTwo)){
echo $row_TESTresultTwo['userName']. " - ". $row_TESTresultTwo['Participant_Name'];
echo "<br />";
}
?>
答案 0 :(得分:0)
问题可能在这一行:
while($row_TESTresultTwo = mysql_fetch_array($TESTresultTwo)){
应该是
while($row_TESTresultTwo = mysql_fetch_array($TESTresult2)){
// as you have no $TESTresultTwo variable...
}
并尝试查询...与LIKE '%".$topName."%'"