-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetBooks.php
More file actions
33 lines (24 loc) · 818 Bytes
/
Copy pathgetBooks.php
File metadata and controls
33 lines (24 loc) · 818 Bytes
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
<?php
include 'includes/login-check.php';
include 'includes/database.php';
$term = mysql_real_escape_string($_REQUEST['term']);
$query=mysql_query("SELECT * FROM books_info where title like '".$term."%' or accession_no like '".$term."%' having flag = 1 and status not in('lost') order by title ");
$json=array();
$i=1;
while($books=mysql_fetch_array($query)){
$type = $books['type'];
if($type == "Reference"){
$json[]=array(
'value'=> $i.".".$books["title"] ." (" . $books["accession_no"].") <Reference Book>"
);
$i++;
}else
{
$json[]=array(
'value'=> $i.".".$books["title"] ." (" . $books["accession_no"].")"
);
$i++;
}
}
echo json_encode($json);
?>