-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsuggestions.php
More file actions
executable file
·31 lines (27 loc) · 911 Bytes
/
suggestions.php
File metadata and controls
executable file
·31 lines (27 loc) · 911 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
<?php
$db = new SQLite3('data/lotus_gene.sqlite');
$val = array();
if(!$db){
echo $db->lastErrorMsg();
}
//where 'term' is the default keyword in jquery autocomplete api
$query = $_POST['term'];
$sql = "select * from gene where id like '%$query%' OR label LIKE '%$query%' OR title LIKE '%$query%'";
$ret = $db->query($sql);
while($row = $ret->fetchArray(SQLITE3_ASSOC) ){
// if( empty( $gene_name ) ){
// $gene_name = $row['Entry'];
// $gene_label = $row['Entry'];
// }else{
// $gene_label = $gene_name . '|' . $row['Entry'];
// }
$val[] = array(
'id'=> $row['id'],
'label'=> $row['label'],
'title' => $row['title']
);
}
//here we convert the result into JSON
echo json_encode($val);
$db->close();
?>