hi
i have a sql statement that tries to find a match for $str_zip
<snip>
$sql="SELECT * FROM $dbtable";
$sql.=" WHERE userid != 0 and 1=1 and email like '%$str_email%'";
}
$sql.=" and firstname like '%$str_firstname%'";
$sql.=" and middlename like '%$str_middlename%'";
$sql.=" and lastname like '%$str_lastname%'";
$sql.=" and address1 like '%$str_address1%'";
$sql.=" and address2 like '%$str_address2%'";
$sql.=" and address3 like '%$str_address3%'";
$sql.=" and city like '%$str_city%'";
$sql.=" and state like '%$str_state%'";
$sql.=" and zip like '%$str_zip%'";
$sql.=" and country like '%$str_country%'";
$sql.=" and letters_sent like '%$str_letters_sent%'";
$sql.=" and status like '%$str_status%'";
if (!empty($str_gender))
{$sql.=" and gender like '$str_gender'";}
if ($str_ethnicity != '')
{$sql.=" and ethnicity like '$str_ethnicity'";}
$sql.=" ORDER BY lastname ASC";
</snip>
i'd like to add 3 more possible values for '$str_zip' - str_zip2, str_zip3,and str_zip4.
i tried the following, but it doesn't seem to work. now my search doesn't find any results...
<snip>
$sql="SELECT * FROM $dbtable";
$sql.=" WHERE userid != 0 and 1=1 and email like '%$str_email%'";
}
$sql.=" and firstname like '%$str_firstname%'";
$sql.=" and middlename like '%$str_middlename%'";
$sql.=" and lastname like '%$str_lastname%'";
$sql.=" and address1 like '%$str_address1%'";
$sql.=" and address2 like '%$str_address2%'";
$sql.=" and address3 like '%$str_address3%'";
$sql.=" and city like '%$str_city%'";
$sql.=" and state like '%$str_state%'";
$sql.=" and zip IN ('$str_zip','$str_zip2','$str_zip3','$str_zip4')";
$sql.=" and country like '%$str_country%'";
$sql.=" and letters_sent like '%$str_letters_sent%'";
$sql.=" and status like '%$str_status%'";
if (!empty($str_gender))
{$sql.=" and gender like '$str_gender'";}
if ($str_ethnicity != '')
{$sql.=" and ethnicity like '$str_ethnicity'";}
$sql.=" ORDER BY lastname ASC";
</snip>
can someone clue me in as to the correct syntax or the correct way to search for multiple possible values of a field?
thanks