<?php
// gets all Customers in json for autocomplete
include 'includes/database.php';
$db=new MySQLDatabase();
$db->open_connection();
$sql = mysqli_query($db->connection, "SELECT DISTINCT cname FROM customers ORDER BY cname;") or die (mysqli_error($db->connection) );
$larray = array();
while ($row = mysqli_fetch_array($sql, MYSQLI_ASSOC)){
    $row_array['value'] = $row['cname'];
    array_push($larray, $row_array); 
    }
echo json_encode($larray);    
$db->close_connection();
?>