so far I have these two arrays:
$field_name[] = $selectedArr['field_name'];
$field_value[] = $selectedArr['field_value'];
one of these arrays contains field names while the other contains field values. Now, if two or more field names array values are the same then the operator in the SQL query should be OR (if not the same AND) between these two or more fields and AND between the rest of the fields.
so if say:
$field_name[0]="Type";
$field_name[1]="Type";
$field_name[2]="Varietal";
and
$field_value[0]="Red";
$field_value[1]="White";
$field_value[2]="Chardonney";
how can I check this with a loop or anything else, and then based on the results dynamically generate sth like this:
$SQLQuery=("SELECT * FROM wines WHERE $field_name[0]=$field_value[0]
OR $field_name[1]=$field_value[1] AND $field_name[2]=$field_value[2]");
can anybody show me or direct me on how to do this? thank you in advance.