Forum Moderators: coopster
$var = $_POST['var'];
$query = "SELECT * FROM table WHERE color LIKE '%". $var ."%'";
if(is_array($_POST['var'])) {
$var_array = $_POST['var'];
$count = count($var_array);
$query = "SELECT * FROM table WHERE color LIKE '%". $var_array[0] ."%'";
$x = 1;
while($x <= $count) {
$query .= " OR LIKE '%". $var_array[$x] ."%'";
$x++;
}
}
$search_query="SELECT * FROM table WHERE
gender = '$gender' AND";
$count = count($bodytype);
$search_query .= " body_type LIKE '%$bodytype[0]%'";
$x = 1;
if(($count > 1) && ($bodytype[1] != "") ) {
while($x <= $count) {
$search_query .= " OR body_type LIKE '%$bodytype[$x]%'";
$x++;
}
}
$search_query .= " AND height = '$height' AND
hair_len = '$hairlength' AND";
$count2 = count($haircolor);
$search_query .= " hair_col LIKE '%$haircolor[0]%'";
$x2 = 1;
if(($count2 > 1) && ($haircolor[1] != "") ) {
while($x2 <= $count2) {
$search_query .= " OR hair_col LIKE '%$haircolor[$x2]%'";
$x2++;
}
}
$search_query .= " AND eye_col = '$eyecolor' AND
cloth_size = '$size' AND
sex_pref = '$preference' AND
weight = '$weight' AND";
$count3 = count($nation);
$search_query .= " nation LIKE '%$nation[0]%'";
$x3 = 1;
if(($count3 > 1) && ($nation[1] != "") ) {
while($x3 <= $count3) {
$search_query .= " OR nation LIKE '%$nation[$x3]%'";
$x3++;
}
}
$mysql_query .= " AND";
$count5 = count($fetish);
$search_query .= " fetish LIKE '%$fetish[0]%'";
$x5 = 1;
if(($count5 > 1) && ($fetish[1] != "")) {
while($x5 <= $count5) {
$search_query .= " OR fetish LIKE '%$fetish[$x5]%'";
$x5++;
}
}
$search_query .= " AND race = '$ethnicity' AND";
$count4 = count($bodydec);
$search_query .= " body_dec LIKE '%$bodydec[0]%'";
if(($count > 1) && ($bodydec[1] != "") ) {
$x4 = 1;
while($x4 <= $count4) {
$search_query .= " OR body_dec LIKE '%$bodydec[$x4]%'";
$x4++;
}
}
$mysql_query .= " AND skin_tone = '$skintone'";