Well, after half pulling my hair out messing with this, I am thinking it is
not possible. I did research and found references to "sub-queries" not
possible in MySQL (I am using 4.0.18-32 with PHP 4). But, not sure if I am
breaking that rule or not.
Psuedo code of what I am trying to do...
<?php
$sql = "select * from table1";
$db_result = mysql_query($sql);
while ($row = mysql_fetch_array($db_result)) {
$table_key = $row("table_key");
$sql2 = "select * from table2 where tabel_key='$table_key'";
$db_result2 = mysql_query($sql2);
$row2 = mysql_fetch_array($db_result2);
if record exists in table2
do something with table 2;
else
do something with table 1;
}
?>
The second query seems to always return an empty array. Is this nested
query allowed in PHP/MySQL?
Thanks in advance for any help,
PTM