Jump to content

[SOLVED] Exact Match Query


phpretard

Recommended Posts

If I check Residential AND Commercial the correct result displays

 

If I check FHA AND VA the correct result displays

 

If I only check one of the boxes then both entries display.

 

My objective is if I check VA only then the row WHERE VA has the value of "1" should display.

 

Both Database entries have FL for the "Search / State" value.

 

I have attached a snip of the database to help illistrate my problem.

 

/// THE FORM

<form action='' method=POST>
<input type='checkbox' name='Residential' value='1'>
<input type='checkbox' name='FHA' value='1'>
<input type='checkbox' name='Commercial' value='1'>
<input type='checkbox' name='VA' value='1'>
<input type='text' name='Search' size=30> 
<input type=submit value=Search name=GOSearch>
</form>


/// THE POST

$Residential=$_POST['Residential'];
$Commercial=$_POST['Commercial'];
$FHA=$_POST['FHA'];
$VA=$_POST['VA'];
$Search=$_POST['Search'];	


/// THE QUERY

$result = mysql_query("SELECT * FROM members WHERE (State='$Search') AND (Residential='$Residential' OR Commercial='$Commercial' OR FHA='$FHA' OR VA='$VA') ORDER by id");



$num_rows = mysql_num_rows($result);

if ($num_rows > 0){

while($row = mysql_fetch_array($result))
{
             RESULT
             }
}

 

Any help today?

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/121767-solved-exact-match-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.