sql Address Select Statement

3665
11
Jump to solution
05-28-2017 07:45 AM
MeganWirth
Occasional Contributor

Need help with a sql statement used to select a specific address. For example I have a database named musickey_TESTER, and a table named PERMITMASTER. I would like to select an exact record from the ADDRESS field. i.e 509 BERRY CT. I have tried many statements but can only get it to work searching on the address number. 

Here is what my statement looks like. 

"select * from PERMITMASTER where ADDRESS LIKE '%$search%' "

This produces no results however when I input just the numeric part of the address it will return any address with that number in the string.

Thanks in advance for any help.

Tags (2)
0 Kudos
11 Replies
MeganWirth
Occasional Contributor

Thank you so much sir! with a slight modification it is now up and running! 

$search = "509 BERRY CT"; changed to $search=$_POST['search']; in order for the user defined form entry to work.

My only issue now is to be able to return the DOCUMENTS field as a hyperlink with a friendly name.
echo $results['PERMIT DOCUMENT'];
Thanks again mirhashmi2014‌ and bixb0012‌ greatly appreciate your efforts.

0 Kudos
MirHashmi
Occasional Contributor

I think something like below should work for you.

// define friendly name
$permitDocument = $results['PERMIT DOCUMENT'];
if(strcasecmp($permitDocument, '123456' )==0)
{
   $friendlyName = "ABC";
}

echo "<a href='".$results['PERMIT DOCUMENT']."'>‍‍‍‍‍‍‍‍‍".$friendlyName."</a>"