-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajx.php
27 lines (21 loc) · 833 Bytes
/
ajx.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
<?php
include("php/dbconnect.php");
if($_GET['type'] == 'studentname'){
$result = $conn->query("SELECT sname,contact FROM student where balance>0 and (sname LIKE '%".$_GET['name_startsWith']."%' or contact LIKE '%".$_GET['name_startsWith']."%') ");
$data = array();
while ($row = $result->fetch_assoc()) {
//array_push($data, $row['sname'].'-'.$row['contact']);
array_push($data, $row['sname']);
}
echo json_encode($data);
}
if($_GET['type'] == 'report'){
$result = $conn->query("SELECT sname,contact FROM student where (sname LIKE '%".$_GET['name_startsWith']."%' or contact LIKE '%".$_GET['name_startsWith']."%') ");
$data = array();
while ($row = $result->fetch_assoc()) {
//array_push($data, $row['sname'].'-'.$row['contact']);
array_push($data, $row['sname']);
}
echo json_encode($data);
}
?>