Hi and thanks for your response. I tried your fix, and I also tried my code again replacing the zero with "any". All three tries resulted in that extra display of the last record. Here's the dbase and query info.
The database includes 9 tables:
4 of the tables are lookup tables and include 3 fields -- type_id, lookup_id, type. The type is just a label.
Another 4 tables are "data" tables -- this is where the info from the lookup tables is linked to a particular record. The fields are -- data_id, lookup_id, record_id.
The 9th table has a bunch of fields and is the main table for the application. For the query below, the field to note is just record_id.
Here's my entire script with the big ol' table join in there:
if ($submit) {
if ($pulldown1 == '0') { // or any...
$equation = "!=";
} else {
$equation = "=";
}
// there would be a total of 4 if (pulldownX) statements
$result = mysql_query
("SELECT *
FROM
main_table,
data_table_1,
data_table_2,
data_table_3,
data_table_4,
lookup_table_1,
lookup_table_2,
lookup_table_3,
lookup_table_4,
WHERE
data_table_1.lookup_id = lookup_table_1.lookup_id AND
data_table_2.lookup_id = lookup_table_2.lookup_id AND
data_table_3.lookup_id = lookup_table_3.lookup_id AND
data_table_4.lookup_id = lookup_table_4.lookup_id AND
data_table_1.record_id = main_table.record_id AND
data_table_2.record_id = main_table.record_id AND
data_table_3.record_id = main_table.record_id AND
data_table_4.record_id = main_table.record_id AND
data_table_1.lookup_id $equation '$pulldown1' AND
data_table_2.lookup_id $equation '$pulldown2' AND
data_table_3.lookup_id $equation '$pulldown3' AND
data_table_4.lookup_id $equation '$pulldown4'", $db);
$row_count = mysql_num_rows($result);
if ($row_count == 0) {
echo ("0 Rows Returned\n");
} else {
while ($row = mysql_fetch_array ($result)) {
$record_id = $row['record_id'];
$title = $row['title'];
echo ("<p>$record_id) $title</p>");
}
}
} // end the first if ($submit)