本文整理汇总了PHP中Sql::SqlQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::SqlQuery方法的具体用法?PHP Sql::SqlQuery怎么用?PHP Sql::SqlQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sql
的用法示例。
在下文中一共展示了Sql::SqlQuery方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FillArray
/**
* Fill an array with the data of News-Messages, which is ready to paste in a ComaLate-Template
* @access public
* @param integer Maximum The maximum count of News-Messages, which should be loaded, if it is -1 all News-Messages will be loaded
* @param boolean ParserDate Should the timsamp of each News-Message parsed to a hunam-readable value?
* @param boolean DisplayAutor Put the author into the array? if it's 'false' the value of the config is decisive if not the name will be shown
* @return array A ComaLate ready Array
*/
function FillArray($Maximum = 6, $ConvertTimestamp = true, $DisplayAuthor = false)
{
$entries = array();
$sql = "SELECT *\n\t\t\t\tFROM " . DB_PREFIX . "news\n\t\t\t\tORDER BY date DESC\n\t\t\t\tLIMIT 0, {$Maximum}";
// if $Maximum is -1 then show all entries
if ($Maximum == -1) {
$sql = "SELECT *\n\t\t\t\t\tFROM " . DB_PREFIX . "news\n\t\t\t\t\tORDER BY date DESC";
}
$entriesResult = $this->_SqlConnection->SqlQuery($sql);
$displayAuthor = false;
if ($this->_Config->Get('news_display_author', 1) == 1) {
$displayAuthor = true;
}
if ($DisplayAuthor) {
$displayAuthor = true;
}
$dateFormat = '';
// get the date-format-string if the date should be human-readable
if ($ConvertTimestamp) {
$dateFormat = $this->_Config->Get('news_date_format', 'd.m.Y');
$dateFormat .= ' ' . $this->_Config->Get('news_time_format', 'H:i:s');
}
// paste all entries into the array
while ($entrie = mysql_fetch_object($entriesResult)) {
$newsAuthor = '';
// set the author if it should be so
if ($displayAuthor) {
$newsAuthor = $this->_ComaLib->GetUserByID($entrie->userid);
}
$entries[] = array('NEWS_DATE' => $ConvertTimestamp ? date($dateFormat, $entrie->date) : $entrie->date, 'NEWS_TEXT' => nl2br($entrie->text), 'NEWS_AUTHOR' => $newsAuthor, 'NEWS_TITLE' => $entrie->title, 'NEWS_ID' => $entrie->id);
}
return $entries;
}
示例2: Logout
function Logout()
{
if ($this->IsLoggedIn) {
$sql = $sql = "UPDATE " . DB_PREFIX . "online\r\n\t\t\t\t\tSET online_loggedon = 'no'\r\n\t\t\t\t\tWHERE online_id='{$this->OnlineID}'";
$this->_SqlConnection->SqlQuery($sql);
}
}
示例3: UpdateDate
/** UpdateDate
* @access public
* @param integer DateID
* @param integer Year
* @param integer Month
* @param integer Day
* @param integer Hour
* @param integer Minute
* @param string Topic
* @param string Location
* @return void
*/
function UpdateDate($DateID, $Year, $Month, $Day, $Hour, $Minute, $Topic, $Location)
{
if (is_numeric($DateID) && is_numeric($Year) && is_numeric($Month) && is_numeric($Day) && is_numeric($Hour) && is_numeric($Minute) && $Location != '' && $Topic != '') {
$date = mktime($Hour, $Minute, 0, $Month, $Day, $Year);
$sql = "UPDATE " . DB_PREFIX . "dates\n\t\t\t\t\tSET date_topic= '{$Topic}',\n\t\t\t\t\tdate_location= '{$Location}',\n\t\t\t\t\tdate_date='{$date}'\n\t\t\t\t\tWHERE date_id={$DateID}";
$this->_SqlConnection->SqlQuery($sql);
}
}
示例4: DeleteMenu
/**
* Deletes a Menu by it's ID
* @access public
* @param integer Menu_menuid The id of the Menu that should be deleted
* @return void
*/
function DeleteMenu($Menu_menuid, $Menu_name)
{
if (is_numeric($Menu_menuid) && $Menu_name != 'DEFAULT') {
$sql = "DELETE\r\n \t\t\t\t\tFROM " . DB_PREFIX . "menu\r\n \t\t\t\t\tWHERE menu_id='{$Menu_menuid}'";
$this->_SqlConnection->SqlQuery($sql);
$sql = "DELETE\r\n\t\t\t\t\tFROM " . DB_PREFIX . "menu_entries\r\n\t\t\t\t\tWHERE menu_entries_menuid='{$Menu_menuid}'";
$this->_SqlConnection->SqlQuery($sql);
}
}
示例5: LoadPage
/**
* @return void
*/
function LoadPage($pagename)
{
$load_old = false;
$change = GetPostOrGet('change');
if (is_numeric($change) && $this->_User->IsLoggedIn && $change != 0) {
$load_old = true;
} else {
$change = 0;
}
if ($load_old) {
$sql = "SELECT *\r\n\t\t\t\t\tFROM " . DB_PREFIX . "pages_history\r\n\t\t\t\t\tWHERE page_id={$pagename}\r\n\t\t\t\t\tORDER BY page_date ASC\r\n\t\t\t\t\tLIMIT " . ($change - 1) . ",1";
} else {
$sql = "SELECT *\r\n\t\t\t\t\t\tFROM " . DB_PREFIX . "pages\r\n\t\t\t\t\t\tWHERE page_name='{$pagename}' AND page_lang='{$this->_Translation->OutputLanguage}'";
}
$page_result = $this->_SqlConnection->SqlQuery($sql);
if (!($page_data = mysql_fetch_object($page_result))) {
$sql = "SELECT *\r\n\t\t\t\t\t\tFROM " . DB_PREFIX . "pages\r\n\t\t\t\t\t\tWHERE page_name='{$pagename}'";
$page_result = $this->_SqlConnection->SqlQuery($sql);
if (!($page_data = mysql_fetch_object($page_result))) {
$sql = "SELECT *\r\n\t\t\t\t\t\t\tFROM " . DB_PREFIX . "pages\r\n\t\t\t\t\t\t\tWHERE page_id='{$pagename}'";
$page_result = $this->_SqlConnection->SqlQuery($sql);
if (!($page_data = mysql_fetch_object($page_result))) {
header("Location: special.php?page=404&want={$pagename}");
die;
}
}
}
//TODO: access deleted pages
if (!$load_old && $page_data->page_access == 'deleted') {
header("Location: special.php?page=410&want={$pagename}");
//HTTP 410 Gone
die;
}
//TODO: generate a warning if an 'old' page is shown
$this->Title = $page_data->page_title;
$this->PositionOfPage($page_data->page_id);
$this->PageID = $page_data->page_id;
$this->Language = $page_data->page_lang;
if ($page_data->page_type == 'text') {
include __ROOT__ . '/classes/page/page_text.php';
$page = new Page_Text($this->_SqlConnection, $this->_Config, $this->_Translation, $this->_ComaLate, $this->_User);
if (!is_numeric($change)) {
$change = 0;
}
$page->LoadPageFromRevision($page_data->page_id, $change);
$this->Text = $page->HTML;
} elseif ($page_data->page_type == 'gallery') {
include __ROOT__ . '/classes/page/page_gallery.php';
$page = new Page_Gallery($this->_SqlConnection, $this->_Config, $this->_Translation, $this->_ComaLate, $this->_User);
$page->LoadPage($page_data->page_id);
$this->Text = $page->HTML;
}
if ($load_old || $page_data->page_access == 'deleted') {
$this->Text = "\n<div class=\"warning\">Sie befinden sich auf einer Seite, die so wie Sie sie sehen, nicht mehr existiert.</div>\n\n" . $this->Text;
}
}
示例6:
/**
* Activates a new account
* @access private
* @param string ActivationCode An md5 code for the new user to identify him without his username
* @return string Page
*/
function _activateRegistration($ActivationCode)
{
$out = '';
if ($this->_Config->Get('activate_throw_admin', '0')) {
$out .= $this->_Translation->GetTranslation('activation_only_by_an_administrator_possible');
} else {
if ($ActivationCode != '') {
$sql = "UPDATE " . DB_PREFIX . "users\n\t\t\t\t\t\tSET user_activated=1, user_activationcode=NULL\n\t\t\t\t\t\tWHERE user_activationcode='{$ActivationCode}'";
$this->_SqlConnection->SqlQuery($sql);
$out .= $this->_Translation->GetTranslation('your_account_has_been_successfully_activated');
}
}
return $out;
}
示例7: sprintf
/**
* Question if a menu should really be deleted
* @access private
* @param integer Menu_menuid The id of the menu that should be deleted
* @return string HTML code
*/
function _deleteMenu($Menu_menuid, $Menu_name)
{
$out = '';
$adminLang = $this->_AdminLang;
if (is_numeric($Menu_menuid) && $Menu_name != 'DEFAULT') {
$sql = "SELECT *\r\n\t \t\t\t\tFROM " . DB_PREFIX . "menu\r\n\t \t\t\t\tWHERE menu_id='{$Menu_menuid}'";
$menuResult = $this->_SqlConnection->SqlQuery($sql);
if ($menu = mysql_fetch_object($menuResult)) {
$out .= "\r\n\t\t\t" . sprintf($adminLang['shall_the_menu_%menutitle%_really_be_deleted?'], $menu->menu_name) . "<br />\r\n\t\t\t<a href=\"admin.php?page=menueditor&action=deleteMenuSure&menu_menuid={$Menu_menuid}&menu_name={$Menu_name}\" class=\"button\">{$adminLang['yes']}</a>\r\n\t\t\t<a href=\"admin.php?page=menueditor\" class=\"button\">{$adminLang['no']}</a>";
} else {
$out .= "Menü konnte nicht gefunden werden. <br /> <a href=\"admin.php?page=menueditor&menu_id=1\" class=\"button\">{$adminLang['back']}</a>";
}
} elseif ($Menu_name == 'DEFAULT') {
$out .= "Das DEFAULT Menü kann aus technischen Gründen nicht gelöscht werden. <br />\r\n\t\t\t\t\t<a href=\"admin.php?page=menueditor\" class=\"button\">{$adminLang['back']}</a>";
}
return $out;
}
示例8: AddMenuEntry
/**
* Creates a new MenuEntry
* @access public
* @param integer Menu_entry_menu_id The ID of the Menu
* @param string Menu_entry_title The Title of the MenuEntry
* @param string Menu_entry_link The Link to the page which the MenuEntry refers to
* @param string Menu_entry_css_id The css id for the menuentry
* @return void
*/
function AddMenuEntry($Menu_entry_menuid, $Menu_entry_title, $Menu_entry_link, $Menu_entry_css_id)
{
if (is_numeric($Menu_entry_menuid) && $Menu_entry_title != '' && $Menu_entry_link != '') {
$sql = "SELECT *\r\n\t \t\t\t\tFROM " . DB_PREFIX . "pages\r\n \t\t\t\t\tWHERE page_id={$Menu_entry_link}";
$pageResult = $this->_SqlConnection->SqlQuery($sql);
$numRows = mysql_num_rows($pageResult);
if ($numRows = 1) {
$page = mysql_fetch_object($pageResult);
$link = "l:" . $page->page_name;
$sql = "SELECT *\r\n\t \t\t\t\t\tFROM " . DB_PREFIX . "menu_entries\r\n \t\t\t\t\t\tWHERE menu_entries_menuid={$Menu_entry_menuid}\r\n \t\t\t\t\t\tORDER BY menu_entries_orderid DESC\r\n\t \t\t\t\t\tLIMIT 1";
$menuResult = $this->_SqlConnection->SqlQuery($sql);
if ($menuEntry = mysql_fetch_object($menuResult)) {
$menu_entry_orderid = $menuEntry->menu_entries_orderid + 1;
} else {
$menu_entry_orderid = 0;
}
$sql = "INSERT INTO " . DB_PREFIX . "menu_entries\r\n\t\t\t\t\t\t(menu_entries_title, menu_entries_link, menu_entries_orderid, menu_entries_menuid, menu_entries_page_id" . ($Menu_entry_css_id != '' ? ', menu_entries_css_id' : '') . ")\r\n\t\t\t\t\t\tVALUES ('{$Menu_entry_title}', '{$link}', {$menu_entry_orderid}, {$Menu_entry_menuid}, {$page->page_id}" . ($Menu_entry_css_id != '' ? ', \'' . $Menu_entry_css_id . '\'' : '') . ")";
$this->_SqlConnection->SqlQuery($sql);
}
}
}
示例9: Sql
$content .= "<a class=\"button\" href=\"install.php?lang={$language}&step=3\">{$admin_lang['back']}</a>";
$ok = false;
}
if ($admin_password != $admin_password2) {
$content = $admin_lang['the_repetition_of_the_password_was_incorrect'];
//"Das Passwort wurde nicht korrekt wiederholt";
$content .= "<a class=\"button\" href=\"install.php?lang={$language}&step=3\">{$admin_lang['back']}</a>";
$ok = false;
}
if ($ok) {
$sqlConnection = new Sql($d_user, $d_pw, $d_server);
$sqlConnection->Connect($d_base);
$sqlConnection->SqlExecMultiple($sql);
$lastid = mysql_insert_id();
$sql = "INSERT INTO {$d_pre}pages_text (page_id, text_page_text,text_page_html)\r\n\t\t\t\tVALUES ({$lastid}, '{$admin_lang['welcome_to_this_homepage']}', '{$admin_lang['welcome_to_this_homepage']}')";
$sqlConnection->SqlQuery($sql);
$content = $admin_lang['installation_complete'];
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title><?php
echo $admin_lang['installation'] . ': ' . $admin_lang['step'] . ' ' . $step;
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="./install.css" type="text/css" media="all" />
<link rel="stylesheet" href="./style.css" type="text/css" media="all" />
</head>