你好我刚接触php并且知之甚少,在我的where语句中我有Status ='A'和z.zoneID = 1,有没有办法让页面用户控制z.zoneID = 1这样他们就可以通过下拉列表将其更改为任何可用的zoneID?
////////Query & Data Display is here/////////
$q=mysql_query("select r.*, f.Functionname, m.Managername, z.Zonename from requests as r inner join functions as f on r.functionID = f.functionID inner join managers as m on r.managerID = m.managerID inner join zones as z on r.zoneID = z.zoneID where Status='A' and z.zoneID=1 order by Functionname");
echo "<table>
<tr>
<th>Function</th>
<th>Manager</th>
</tr>"
;
while($nt=mysql_fetch_array($q)){
echo"<b>Zone: $nt[Zonename]<br>Capacity: $nt[Zonecapacity]</b><br><br>";
echo "<tr><td>$nt[Functionname]</td><td>$nt[Managername]</td></tr>";
}
echo "</table>";
/////////////////////////////////////
答案 0 :(得分:0)
这可以帮助你...
if( isset($_POST['zoneid']) ){
$zoneID = $_POST['zoneid'];
//Your extra code or processing here.
}
$q=mysql_query("select r.*, f.Functionname, m.Managername, z.Zonename from requests as r inner join functions as f on r.functionID = f.functionID inner join managers as m on r.managerID = m.managerID inner join zones as z on r.zoneID = z.zoneID where Status='A' and z.zoneID=1 order by Functionname");
echo "<table>
<tr>
<th>Function</th>
<th>Manager</th>
</tr>"
;
// Here we create a form
echo "<form method='post' >";
echo "<Search for ZoneID: <input type='number' name='zoneid' /><br>";
echo "<input type='submit' value='search' />";
echo "</form>";
while($nt=mysql_fetch_array($q)){
echo"<b>Zone: ".$nt['Zonename']."<br>Capacity: ".$nt['Zonecapacity']."</b><br><br>";
echo "<tr><td>$nt[Functionname]</td><td>$nt[Managername]</td></tr>";
}
echo "</table>";
?>