Mira esto lo acabo de hacer  con Dreamweaver, es una consulta que busca comunas o sectores...revísala y sólo reemplaza los valores de tus tablas para que veas el resultado, ..saludos 
     
Código PHP:
Ver original- <?php require_once('Connections/administracion.php'); 
-   
- function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")  
- { 
-   if (PHP_VERSION < 6) { 
-   } 
-   
-   
-   switch ($theType) { 
-     case "text": 
-       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
-       break;     
-     case "long": 
-     case "int": 
-       $theValue = ($theValue != "")-  ?  intval($theValue) : "NULL";
 
-       break; 
-     case "double": 
-       $theValue = ($theValue != "")-  ?  doubleval($theValue) : "NULL";
 
-       break; 
-     case "date": 
-       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
-       break; 
-     case "defined": 
-       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; 
-       break; 
-   } 
-   return $theValue; 
- } 
- } 
-   
- $colname_comuna = "-1"; 
- if (isset($_POST['comuna']) && !empty($_POST['comuna'])) { 
-   $colname_comuna = $_POST['comuna']; 
- } 
- $query_comuna = sprintf("SELECT comuna FROM comunas WHERE comuna LIKE %s",-  GetSQLValueString ("%" . $colname_comuna . "%", "text"));
 
-   
- $colname_sector = "-1"; 
- if (isset($_POST['sector'])&& !empty($_POST['sector']) ) { 
-   $colname_sector = $_POST['sector']; 
- } 
- $query_sector = sprintf("SELECT sector FROM sector WHERE sector LIKE %s",-  GetSQLValueString ("%" . $colname_sector . "%", "text"));
 
- ?> 
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
- <html xmlns="http://www.w3.org/1999/xhtml"> 
- <head> 
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
- <title>Documento sin título</title> 
- </head> 
-   
- <body> 
- <form action="busca.php" method="post"> 
-   <label for="comuna">Comuna</label> 
-   <input type="text" name="comuna" id="comuna" /> 
-   <label for="sector">Sector</label> 
-   <input type="text" name="sector" id="sector" /> 
-   <input type="submit" name="boton" id="boton" value="Buscar" /> 
- </form> 
-   
- <?php do { ?> 
-   <table> 
-     <tr> 
-       <td><?php echo $row_comuna['comuna']; ?></td> 
-     </tr> 
-   </table> 
-    
- <?php do { ?> 
-   <table> 
-     <tr> 
-       <td><?php echo $row_sector['sector']; ?></td> 
-     </tr> 
-   </table> 
-    
-   
- </body> 
- </html> 
- <?php 
-   
- ?>