/var/www/(Del)pathways.org.hk/MIS20140127/old20140407/staff/list2.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include_once '../include/DBConnect.php';
/* If connection to database, run sql statement. */
//$q = strtolower($_GET["Data"]);
//$q = "l";
if ($_POST) {
    
$q strtolower($_POST['Data']);
    
/*
      $query = "select * from branch where Branch_ID LIKE '$q%'";
      $result = $DB->query($query);
      while ($row = $result->fetch_object()) {
      $BID = $row->Branch_ID;
      echo "$BID \n";
      }
      mysqli_close($DB);
     * 
     */

    //$ResultSet = "nothing!!";
    
$deleted 0;
    
$query "SELECT * FROM `staff` WHERE `last_name` LIKE '$q%' AND `deleted` = '$deleted'";
    
$result $dbh->prepare($query);
    
$result->execute();
    while (
$ResultSet $result->fetch(PDO::FETCH_ASSOC)) {
        
$Array = array(
            
"last_name" => $ResultSet['last_name'],
            
"first_name" => $ResultSet['first_name'],
            
"ch_name" => $ResultSet['ch_name'],
            
"root_id" => $ResultSet['root_id'],
            
"staff_id" => $ResultSet['staff_id']
        );
        
$Arrays[] = $Array;
    };
}
echo 
json_encode($Arrays);
?>