import without cron

This commit is contained in:
Maryana Rozhankivska
2014-04-02 22:33:06 +03:00
10 changed files with 61 additions and 48 deletions

View File

@ -407,14 +407,15 @@ class Database {
public function getLastId($column = '') {
return $this->getHandle()->lastInsertId($column);
}
public function search($term){
$search = '%'.$term.'%';
$query = $this->getHandle()->prepare("SELECT * FROM entries WHERE content LIKE ? OR title LIKE ? OR url LIKE ?"); //searches in content, title and URL
$query->execute(array($search,$search,$search));
$entries = $query->fetchAll();
return $entries;
}
public function search($term, $user_id, $limit = '') {
$search = '%'.$term.'%';
$sql_action = "SELECT * FROM entries WHERE user_id=? AND (content LIKE ? OR title LIKE ? OR url LIKE ?) "; //searches in content, title and URL
$sql_action .= $this->getEntriesOrder().' ' . $limit;
$params_action = array($user_id, $search, $search, $search);
$query = $this->executeQuery($sql_action, $params_action);
return $query->fetchAll();
}
public function retrieveAllTags($user_id, $term = null) {
$sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags