Jump to content

Help With A Query


phpretard

Recommended Posts

I can't figure out why this query still shows results where PaidID='1'.

 

The url calling this would be: ...?page=listing/results&State=FL

 

OR

 

$SEARCH="FL"; << Session

 

if (!ereg('[^0-9]', $SEARCH)){$searchResult = mysql_query("SELECT * FROM members WHERE ZipCodes LIKE '%$SEARCH%' AND  PaidID!='1' ");}

elseif (!ereg('[^A-Z]', $SEARCH) && (strlen($SEARCH) == 2)){
$searchResult = mysql_query("SELECT * FROM members WHERE PaidID!='1' AND LicState LIKE '%$SEARCH%' OR LicState2 LIKE '%$SEARCH%' OR LicState3 LIKE '%$SEARCH%' OR LicState4 LIKE '%$SEARCH%' ");
}

elseif (isset($_GET['State'])){

$searchResult = mysql_query("SELECT * FROM members WHERE PaidID!='1' AND

(LicState='$State' AND Counties LIKE '%$SEARCH%' ) OR
(LicState2='$State' AND Counties2 LIKE '%$SEARCH%') OR
(LicState3='$State' AND Counties3 LIKE '%$SEARCH%') OR
(LicState4='$State' AND Counties4 LIKE '%$SEARCH%')

");

}

elseif ($SEARCH=="EXAMPLE"){
$searchResult = mysql_query("SELECT * FROM members WHERE PaidID!='1' ORDER BY RAND() LIMIT 5");
}

else{
$searchResult = mysql_query("SELECT * FROM members WHERE PaidID!='1' AND Counties LIKE '%$SEARCH%' OR Counties2 LIKE '%$SEARCH%' OR Counties3 LIKE '%$SEARCH%' OR Counties4 LIKE '%$SEARCH%' ");
}

 

Could anyone tell me?

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/129385-help-with-a-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.