Tags.php
资源名称:ext-3.0.0.zip [点击查看]
上传用户:shuoshiled
上传日期:2018-01-28
资源大小:10124k
文件大小:1k
源码类别:
中间件编程
开发平台:
JavaScript
- <?php
- class Tags {
- function load($data){
- $db = new SQLiteDatabase('sql/imgorg.db');
- // use $query for type-ahead
- $query = $data->query;
- $qryStr = 'SELECT * FROM Tags';
- if ($query) {
- $qryStr .= ' where text like "'.$query.'%"';
- }
- $q = $db->query($qryStr);
- return $q->fetchAll();
- }
- function getTags($data) {
- $db = new SQLiteDatabase('sql/imgorg.db');
- $image = $data->image;
- $q = $db->query('SELECT t.text as text, t.id as id FROM Tags t INNER JOIN Images_Tags it ON t.id = it.tag_id WHERE it.image_id = "'.$image.'"');
- return $q->fetchAll();
- }
- }