Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.