You can now search by phone numbers with dashes or () before it requied you to only type in the numbers only

This commit is contained in:
johnnyq
2022-03-05 14:41:52 -05:00
parent d7fd8cc736
commit d1ee7ce5aa
5 changed files with 41 additions and 12 deletions

View File

@@ -13,8 +13,14 @@ if(isset($_GET['p'])){
if(isset($_GET['q'])){
$q = mysqli_real_escape_string($mysqli,$_GET['q']);
//Phone Numbers
$phone_query = preg_replace("/[^0-9]/", '',$q);
if(empty($phone_query)){
$phone_query = $q;
}
}else{
$q = "";
$phone_query = "";
}
if(!empty($_GET['sb'])){
@@ -41,7 +47,7 @@ $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o
$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM locations
WHERE location_client_id = $client_id
AND (location_name LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$q%')
AND (location_name LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%')
ORDER BY $sb $o LIMIT $record_from, $record_to");
$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));