PHP:一个查询中有两个表

I have two different queries as follows....

Here is the list of my Network and Buildging Name.

Network            BuildingName
Mass and Mobile    Araneta
Mass and Mobile    Home Sweet
Hotels             Atrium Hotels

Example: In my combobox the network that will be displayed there is "Mass and Mobile" and "Hotels" after that when I choose Mass and Mobile it will display the "Araneta" and "Home Sweet" with CHECKBOX. So here is my program.

 echo "<div><input type='checkbox' class='checkall'> Check all</div>";
    $section = mysql_query("SELECT fldBldgName FROM tblbuilding where fldNetname = '$get_ID' ORDER BY fldBldgName");
    while ($row = mysql_fetch_array($section))
    {
        echo "<tr><td>";
        echo "<div><input id='playbldg' type='checkbox'  name='play[]' class='chk_boxes1' value='" . $row['fldBldgName']."'>";
        echo $row['fldBldgName'];"</div>";
        echo "</td></tr><br/>";
    }
    echo "<br/>";
    echo "<br/>";
    echo "<input type='submit' name='save' value='Add'  onClick='checkFields()'>";

Here is my code for another table...Name it tbldata[this field is for saving the information]

Example List in my database for tbldata. As we can see I already have a total duration field...

fldNetname          fldBldgName       fldTotalDuration
Mass and Mobile     Araneta            08:00:00
Mass and Mobile     Home Sweet         00:25:00

In Mass and Mobile the maximum total duration is 08:00:00, as we can see the building of Araneta is already full but the Home Sweet is not yet full....

I'm planning to do is, If the building name of Araneta is already full there is no checkbox for it but when it is less than 08:00:00 the checkbox will appear....

Example output that I want to do:

Araneta - 08:00:00

Home Sweet - 00:25:00

OUTPUT: assuming the "[]" is the checkbox

   Araneta
[] Home Sweet
[] Sugar Free
[] Google

How may I achieve?

Hope this works for you

    echo "<div><input type='checkbox' class='checkall'> Check all</div>";
    $section = mysql_query("SELECT fldBldgName,if(fldTotalDuration<'08:00:00','show','notshow') as status FROM tblbuilding where fldNetname = '$get_ID' ORDER BY fldBldgName");
    while ($row = mysql_fetch_array($section))
    {
        echo "<tr><td>";
        if($row['status']=='show'){
            echo "<div><input id='playbldg' type='checkbox'  name='play[]' class='chk_boxes1' value='" . $row['fldBldgName']."'>";
        }
        else{
            echo "<div>";
        }       
        echo $row['fldBldgName'];"</div>";
        echo "</td></tr><br/>";
    }
    echo "<br/>";
    echo "<br/>";
    echo "<input type='submit' name='save' value='Add'  onClick='checkFields()'>";