<?php
   session_start();

  include("../../db.php"); /* ESTABLISH CONNECTION IN THIS FILE; MAKE SURE THAT IT IS mysqli_* */
  
 
 $term=$_GET['term'];

  $stmt = $conn->prepare("SELECT name FROM customer where name like '%$term%'  ORDER BY IF(name RLIKE '^[a-z]', 1, 2), name
 limit 10"); /* START PREPARED STATEMENT */
  $stmt->execute(); /* EXECUTE THE QUERY */
  $stmt->bind_result($description); /* BIND THE RESULT TO THIS VARIABLE */
  while($stmt->fetch()){ /* FETCH ALL RESULTS */
    $description_arr[] = $description; /* STORE EACH RESULT TO THIS VARIABLE IN ARRAY */
  } /* END OF WHILE LOOP */

  echo json_encode($description_arr); /* ECHO ALL THE RESULTS */
  
  
  
  

?>
