[b]EDITED by ryanlwh: removed the connection info for security reason stated by Ken[/b] I am a relative newbie, so I apologize for my ignorance. I am using the form handler below to query a single table and spit back a table of results. [code]<!-- Cedula Query Form Handler --> <?php $cedula2 = $_POST['cedula']; $canton2 = $_POST['canton']; $link = mysql_connect('****', '****', '****'); if (!$link) { die('Not connected : ' . mysql_error()); } // make canton2 the current db $db_selected = mysql_select_db($canton2, $link); if (!$db_selected) { die ('Can\'t connect to $canton2 : ' . mysql_error()); } ?> <?php $query = mysql_fetch_array(mysql_query("SELECT * FROM informacion_registral WHERE CEDULA_PERSONAL LIKE '$cedula2'"), MYSQL_ASSOC); echo "<table cellpadding=1 cellspacing=1 border=1>\n"; foreach ($query as $key => $value) { echo "<tr><td>$key</td><td>$value</td></tr>\n"; } echo "</table>\n"; ?>[/code] The table it spits out looks like this. When I enter 105710879 as the Cedula in the first form. <!-- Cedula Query Form Handler --> <table cellpadding=1 cellspacing=1 border=1> <tr><td>ID</td><td>6</td></tr> <tr><td>REC_NO</td><td>6</td></tr> <tr><td>CATASTRO_LINC</td><td>64302</td></tr> <tr><td>PROPIETARIO</td><td>xxxxxxx</td></tr> <tr><td>CEDULA_PERSONAL</td><td>105710879</td></tr> <tr><td>FOLIO_REAL</td><td>230810</td></tr> <tr><td>PLANO_CATASTRO</td><td>xxxxxxx</td></tr> <tr><td>FECHA_INSCRIPCION</td><td>xxxxx</td></tr> <tr><td>AREA_REGISTRO</td><td>217.58</td></tr> <tr><td>NATURALEZA</td><td></td></tr> <tr><td>GRAVAMENES</td><td></td></tr> <tr><td>ANOTACIONES</td><td></td></tr> <tr><td>OBSERVACIONES</td><td> </td></tr> </table> What I would like to do is use the value for CATASTRO_LINC (in this case 64302) in another query. Is there a call of some kind which will pull the catastrol_linc value out of that array and make it a variable so that I can use it to query a second related table and display its records as well? Ideally I would like to spit it back into another query and generate another table underneath. [code] ... <?php $query = mysql_fetch_array(mysql_query("SELECT * FROM TABLE2 WHERE CATASTRO_LINC LIKE '$the variable we created from the array'"), MYSQL_ASSOC); echo "<table cellpadding=1 cellspacing=1 border=1>\n"; foreach ($query as $key => $value) { echo "<tr><td>$key</td><td>$value</td></tr>\n"; } echo "</table>\n"; ?>[/code] I hope this makes sense, and thank you for any insite on how to do this. Cheers. Spencer