diff --git a/global_search.php b/global_search.php index adf1b380..0b73e040 100644 --- a/global_search.php +++ b/global_search.php @@ -7,6 +7,7 @@ if(isset($_GET['query'])){ $query = mysqli_real_escape_string($mysqli,$_GET['query']); $sql_clients = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN locations ON clients.client_id = locations.location_client_id WHERE client_name LIKE '%$query%' AND clients.company_id = $session_company_id ORDER BY client_id DESC LIMIT 5"); + $sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts LEFT JOIN clients ON client_id = contact_client_id WHERE contact_name LIKE '%$query%' AND contacts.company_id = $session_company_id ORDER BY contact_id DESC LIMIT 5"); $sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY vendor_id DESC LIMIT 5"); $sql_products = mysqli_query($mysqli,"SELECT * FROM products WHERE product_name LIKE '%$query%' AND company_id = $session_company_id ORDER BY product_id DESC LIMIT 5"); $sql_documents = mysqli_query($mysqli, "SELECT * FROM documents LEFT JOIN clients on document_client_id = clients.client_id WHERE document_name LIKE '%$query%' AND documents.company_id = $session_company_id ORDER BY document_id DESC LIMIT 5"); @@ -44,11 +45,7 @@ if(isset($_GET['query'])){ while($row = mysqli_fetch_array($sql_clients)){ $client_id = $row['client_id']; $client_name = $row['client_name']; - $location_phone = $row['location_phone']; - if(strlen($location_phone)>2){ - $location_phone = substr($row['location_phone'],0,3)."-".substr($row['location_phone'],3,3)."-".substr($row['location_phone'],6,4); - } - //$client_email = $row['client_email']; + $location_phone = formatPhoneNumber($row['location_phone']); $client_website = $row['client_website']; ?> @@ -70,6 +67,59 @@ if(isset($_GET['query'])){ + 0){ ?> + + + +
+ + + 0){ ?>