I have a select list that shows a list that shows this:
Tech Name | Tech Zip | Tech States (Value=Tech ID)
All of this is coming from a recordset. Now, I want to see whether or not this tech exists in another table. If he does NOT, then I want to show him in the select list. Otherwise, ignore him.
UPDATE
Using the stuff from the answer below, this is what I've come up with. I think it is working. Is this the best way to do this?
mysql_select_db($database_localhost, $localhost);
$query_NeededTechs = "
SELECT l.*
FROM zip_tech l
WHERE NOT EXISTS
(
SELECT tech_name
FROM zip_zip r
WHERE r.tech_name = l.tech_name
)
";
$NeededTechs = mysql_query($query_NeededTechs, $localhost) or die(mysql_error());
$row_NeededTechs = mysql_fetch_assoc($NeededTechs);
$totalRows_NeededTechs = mysql_num_rows($NeededTechs);
My Select List:
<select name="select" id="select">
<?php
do {
?>
<option value="<?php
echo $row_NeededTechs['tech_id']?>"><?php echo $row_NeededTechs['tech_name'] . " | " . $row_NeededTechs['tech_zip'] . " | " . $row_NeededTechs['states']?></option>
<?php
} while ($row_NeededTechs = mysql_fetch_assoc($NeededTechs));
$rows = mysql_num_rows($NeededTechs);
if($rows > 0) {
mysql_data_seek($NeededTechs, 0);
$row_NeededTechs = mysql_fetch_assoc($NeededTechs);
}
?>
</select>