I have a small problem - How do I display the results of the second query?
I have a form. I select a Device from a drop down box:
$device = $_POST['device'];
$query="SELECT DISTINCT device from devices";
$result=mysql_query($query);
$form.="<form action=\"$self\" method=\"post\" name=\"cd\"><tr>";
$form.="<td align=\"center\"><select name=\"device\">";
$form.="<option value=\"\" selected>- Select Device -</option>";
while($row=mysql_fetch_array($result)) {
$form.="<option value=\"$row[device]\">$row[device]";
}
Then I run a cross table query based on the posted device:
$sql = "select commandID from commands where x10_channel = (select x10_channel from devices where device = '$device')";
How do I display the results of this query? This doesn't work:
$rs = @mysql_query( $sql,$conn);
$rows = mysql_num_rows($rs);
$commandID=$row["commandID"];
if(mysql_num_rows($rs))
{
while( $row = mysql_fetch_array( $rs ) ){
echo '<tr><td><font size="2" face="Verdana"> . $commandID . </td></tr>';
}
Thanks.