本文整理汇总了PHP中Project::getDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getDatabase方法的具体用法?PHP Project::getDatabase怎么用?PHP Project::getDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::getDatabase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllPosts
function getAllPosts()
{
$sql = "SELECT t1.id as post_id,t1.title as post_title,t1.small_text,t1.full_text,t1.creation_date,t1.comments,t1.views,t2.name as catalog_name,t3.title as blog_name,t3.user_id,t4.name as tag_name FROM blog_post t1\r\n\t\t\t\t\tINNER JOIN ub_tree t2 ON t1.ub_tree_id = t2.id\r\n\t\t\t\t\tINNER JOIN blog t3 ON t2.blog_id = t3.id\r\n\t\t\t\t\tLEFT JOIN bc_tag t4 ON t1.bc_tag_id = t4.id\r\n\t\t\t\t\tORDER BY t1.creation_date\r\n\t\t\t \t\tDESC LIMIT ?d, ?d";
$result = Project::getDatabase()->selectPage($this->_countRecords, $sql, $this->_pager->getStartLimit(), $this->_pager->getPageSize());
$this->updatePagerAmount();
return $result;
}
示例2: getUserWarningCount
function getUserWarningCount($user_id)
{
$DE = Project::getDatabase();
$sql = "\r\n SELECT count(*) as c\r\n FROM warning\r\n WHERE user_id = '" . $user_id . "'\r\n ";
$result = $DE->selectRow($sql);
return $result['c'];
}
示例3: GetIDBy
/**
* Читает строку таблицы "social_pos_criteria_votes"
* $p_spos_id - ID Соц. позиции
* $p_scriteria_id - ID Критерия
*/
public function GetIDBy($p_spos_id = 0, $p_scriteria_id = 0)
{
$v_spos_id = (int) $p_spos_id;
$v_scriteria_id = (int) $p_scriteria_id;
$sql = "\r\n SELECT *\r\n FROM `social_pos_criteria_votes` s\r\n WHERE s.`social_pos_id` = ?d and s.`social_criteria_id` = ?d";
$result = Project::getDatabase()->select($sql, $v_spos_id, $v_scriteria_id);
return $result[0]['id'];
}
示例4: setRelation
function setRelation($user1_id, $user2_id, $text)
{
if (Project::getDatabase()->select("SELECT * FROM `users_relations` WHERE `user1_id`=?d AND `user2_id`=?d", $user1_id, $user2_id)) {
Project::getDatabase()->query("UPDATE `users_relations` SET `text`=?s WHERE `user1_id`=?d AND `user2_id`=?d", htmlspecialchars($text), $user1_id, $user2_id);
} else {
Project::getDatabase()->query("INSERT INTO `users_relations` SET `text`=?s, `user1_id`=?d, `user2_id`=?d", htmlspecialchars($text), $user1_id, $user2_id);
}
}
示例5: loadWhere
public function loadWhere($articleTreeId, $dataBegin = null, $dataEnd = null)
{
$sql = "SELECT * FROM {$this->_table} a WHERE a.`id_article_tree` = ?d ";
$dataBegin !== null ? $sql .= "AND ((a.`data_begin` <= '{$dataBegin}' AND a.`data_end` > '{$dataBegin}') " : "";
$dataEnd !== null ? $sql .= "OR (a.`data_end` >= '{$dataEnd}' AND a.`data_begin` < '{$dataEnd}'))" : ")";
//die($sql);
return Project::getDatabase()->select($sql, $articleTreeId);
}
示例6: loadByLabel
function loadByLabel($label)
{
$DE = Project::getDatabase();
$result = array();
$result = $DE->selectRow("SELECT * FROM " . $this->_table . " WHERE label = ?", $label);
$this->bind($result);
return $result;
}
示例7: loadDefault
function loadDefault($admin = true)
{
$DE = Project::getDatabase();
$result = array();
$result = $DE->selectRow("SELECT * FROM " . $this->_table . " WHERE `default`=1 AND admin=?d LIMIT 1", $admin);
$this->bind($result);
return $result;
}
示例8: loadByParentId
public function loadByParentId($id)
{
$id = (int) $id;
$DE = Project::getDatabase();
$parent = $DE->selectRow("SELECT * FROM {$this->_table} WHERE id = ?d", $id);
$result = $DE->select("SELECT * FROM {$this->_table} WHERE {$this->_table}.key like '" . $parent['key'] . "%' AND {$this->_table}.level = ?d AND {$this->_table}.active = 1 order by 'key'", $parent['level'] + 1);
return $result;
}
示例9: getDefaultService
function getDefaultService()
{
// TODO:: caching
$DE = Project::getDatabase();
$result = array();
$result = $DE->selectRow("SELECT * FROM " . $this->_table . " WHERE client_id = ?d AND `default` = 1", $this->_client_id);
$this->bind($result);
return $result;
}
示例10: insertTagLink
/** Вставка записи в таблицу `bookmarks_tags_links`
* $p_bookmark_id - ID закладки
* $p_tag_id - ID тега
*/
public function insertTagLink($p_bookmark_id, $p_tag_id)
{
$v_bookmark_id = (int) $p_bookmark_id;
$v_tag_id = (int) $p_tag_id;
if ($v_bookmark_id > 0 and $v_tag_id > 0) {
$sql = "INSERT INTO `bookmarks_tags_links` VALUES (null, ?d, ?d)";
Project::getDatabase()->query($sql, $v_bookmark_id, $v_tag_id);
}
}
示例11: GetCountRecComment
/**
* Функция возвращает количество строк в таблице в зависимости от условия WHERE
* Необходима для определения наличия комментариев к соц.позиции для конкретного пользователя
*/
public function GetCountRecComment($p_user = 0, $p_social_pos_id = 0)
{
if ((int) $p_user == 0 or $p_social_pos_id == 0) {
return 0;
}
$sql = "\n SELECT count(*) as cnt \n FROM `social_comments` s \n WHERE s.`user_id`=?d and s.`social_pos_id`=?d\n ";
$result = Project::getDatabase()->select($sql, (int) $p_user, (int) $p_social_pos_id);
return $result[0]['cnt'];
}
示例12: loadQuestion
public function loadQuestion($id)
{
$id = (int) $id;
$sql = "SELECT " . "questions.`id`," . "questions.`questions_cat_id`," . "questions.`a_count`," . "questions.`q_text`," . "questions.`user_id`," . "questions.`creation_date`," . "users.`login` " . "FROM questions " . "LEFT JOIN users " . "ON questions.`user_id` = users.id " . "WHERE questions.`id` = ?d";
//die($sql);
$result = Project::getDatabase()->selectRow($sql, $id);
$this->bind($result);
return $result;
}
示例13: exists
function exists($name)
{
$sql = "SELECT * " . " FROM bc_tag " . " WHERE " . " param_group_id = ?d" . " AND LOWER(name) = LOWER(?)";
$rez = Project::getDatabase()->selectRow($sql, $name);
if (count($rez) === 0) {
return false;
} else {
return $rez;
}
}
示例14: exists
function exists($group_id, $param_name)
{
$DE = Project::getDatabase();
$sql = "SELECT * " . " FROM param " . " WHERE " . " param_group_id = ?d" . " AND LOWER(param.name) = LOWER(?)";
$rez = $DE->selectRow($sql, $group_id, $param_name);
if (count($rez) === 0) {
return false;
} else {
return $rez;
}
}
示例15: getCorrespondenceBetweenUsers
function getCorrespondenceBetweenUsers($aUsersID)
{
$DE = Project::getDatabase();
$result = array();
if ($aUsersID) {
$sUsersId = implode(",", $aUsersID);
$sql = "\r\n SELECT messages.*, messages.id as messages_id,\r\n u_author.login as author_login\r\n FROM messages\r\n INNER JOIN users as u_author\r\n ON u_author.id = messages.author_id\r\n WHERE messages.author_id IN (" . $sUsersId . ") AND messages.recipient_id IN (" . $sUsersId . ") AND (messages.is_deleted = '0' OR messages.is_deleted = '1')";
$sql .= " ORDER BY messages.send_date ";
$result = $DE->select($sql);
}
return $result;
}