mirror of
https://github.com/myronblair/tomsjavajive
synced 2026-06-30 17:50:32 -05:00
Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Tom's Java Jive - Customer Search API
|
||||
*/
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
require_once __DIR__ . '/../includes/functions.php';
|
||||
|
||||
$query = $_GET['q'] ?? '';
|
||||
|
||||
if (strlen($query) < 2) {
|
||||
jsonResponse([]);
|
||||
}
|
||||
|
||||
$customers = db()->fetchAll(
|
||||
"SELECT customer_id, email, name, phone, wallet_balance, reward_points
|
||||
FROM customers
|
||||
WHERE (email LIKE :q OR name LIKE :q OR phone LIKE :q) AND is_active = 1
|
||||
ORDER BY name ASC
|
||||
LIMIT 20",
|
||||
['q' => '%' . $query . '%']
|
||||
);
|
||||
|
||||
jsonResponse($customers);
|
||||
Reference in New Issue
Block a user