本文整理汇总了PHP中Mysql::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::getConnection方法的具体用法?PHP Mysql::getConnection怎么用?PHP Mysql::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mysql
的用法示例。
在下文中一共展示了Mysql::getConnection方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetPagesDataArray
public function GetPagesDataArray($hidden = false)
{
$pagesData = array();
$mainCounter = 0;
$subCounter = 0;
$database = Mysql::getConnection();
if ($hidden == false) {
$data = $database->Query("SELECT * FROM " . TABLE_PREFIX . "pages WHERE pageParent='0' AND pageShow='1' ORDER BY pagePosition ASC;");
} else {
if ($hidden == true) {
$data = $database->Query("SELECT * FROM " . TABLE_PREFIX . "pages WHERE pageParent='0' ORDER BY pagePosition ASC;");
}
}
while ($row = $data->fetch_array()) {
$pageId = $row["pageId"];
$parentPage = new Page();
$parentPage->GetInfo($pageId);
$pagesData[$mainCounter][$subCounter]["pageId"] = $parentPage->pageId;
$pagesData[$mainCounter][$subCounter]["pageTitle"] = $parentPage->pageTitle;
$pagesData[$mainCounter][$subCounter]["pageType"] = $parentPage->pageType;
$subPageData = $database->Query("SELECT * FROM " . TABLE_PREFIX . "pages WHERE pageParent='{$parentPage->pageId}' AND pageShow='1' ORDER BY pagePosition ASC;");
while ($subRow = $subPageData->fetch_array()) {
$subPageId = $subRow["pageId"];
$subPage = new Page();
$subPage->GetInfo($subPageId);
$subCounter++;
$pagesData[$mainCounter][$subCounter]["pageId"] = $subPage->pageId;
$pagesData[$mainCounter][$subCounter]["pageTitle"] = $subPage->pageTitle;
$pagesData[$mainCounter][$subCounter]["pageType"] = $parentPage->pageType;
}
$subCounter = 0;
$mainCounter++;
}
return $pagesData;
}
示例2: delete
public function delete()
{
if ($this->id != null) {
$database = Mysql::getConnection();
$database->Query("DELETE FROM " . TABLE_PREFIX . "m_actualities WHERE id='{$this->id}';");
}
}
示例3: Register
public function Register($userNickname, $userPasswd, $userEmail)
{
$database = Mysql::getConnection();
$userNickname = $database->handler->real_escape_string($userNickname);
$userEmail = $database->handler->real_escape_string($userEmail);
$userPasswd = $this->PasswdHash($userPasswd);
$database->Query("INSERT INTO " . TABLE_PREFIX . "users VALUES ('', '{$userNickname}', '{$userEmail}', '', '{$userPasswd}');");
}
示例4: delete
/**
* @return bool
*/
public function delete()
{
if ($this->id != "") {
$database = Mysql::getConnection();
$database->Query("DELETE FROM " . TABLE_PREFIX . "m_gallery WHERE id='{$this->id}';");
return true;
}
return false;
}
示例5: Install
public static function Install($template)
{
require_once ABS_PATH . '/temp/' . $template . '/install.php';
$database = Mysql::getConnection();
$database->Query("INSERT INTO " . TABLE_PREFIX . "templates VALUES ('', '" . $installData['templateName'] . "', '" . $installData['templateAuthor'] . "', '" . $installData['templateVersion'] . "', '0','" . $installData['templateDescription'] . "');");
$debug = new Debug();
$debug->debugType = 0;
$debug->debugMessage = Lang::$langData['installTemplate'] . " (" . $template . ")";
$debug->StartDebug();
}
示例6: TemplateLoader
private function TemplateLoader()
{
$tempFiles = scandir(ABS_PATH . '/temp/');
for ($i = 2; $i < count($tempFiles); $i++) {
$database = Mysql::getConnection();
$query = $database->Query("SELECT * FROM " . TABLE_PREFIX . "templates WHERE templateName='{$tempFiles[$i]}';");
if (!$query->num_rows) {
Template::Install($tempFiles[$i]);
}
}
}
示例7: delete
/**
* @return bool
*/
public function delete()
{
if ($this->id != "") {
$database = Mysql::getConnection();
$database->Query("DELETE FROM " . TABLE_PREFIX . "m_gallery_pictures WHERE id='{$this->id}';");
if (file_exists(ABS_PATH . "/upload/modules/gallery/" . $this->file)) {
unlink(ABS_PATH . "/upload/modules/gallery/" . $this->file);
}
return true;
}
return false;
}
示例8: GenerateDataArray
public function GenerateDataArray()
{
$database = Mysql::getConnection();
if ($this->onlyVisible) {
$data = $database->Query("SELECT * FROM " . TABLE_PREFIX . "pages WHERE pageShow='1' AND pageParent='0' ORDER BY pagePosition ASC;");
} else {
$data = $database->Query("SELECT * FROM " . TABLE_PREFIX . "pages WHERE pageParent='0' ORDER BY pagePosition ASC;");
}
while ($row = $data->fetch_array()) {
$pageId = $row["pageId"];
$parentPage = new Page();
$parentPage->GetInfo($pageId);
if ($database->Query("SELECT * FROM " . TABLE_PREFIX . "modules WHERE moduleName='simpleRoutes' AND moduleStatus='1';")->num_rows) {
$routeQuery = $database->Query("SELECT routeVal FROM " . TABLE_PREFIX . "m_routes WHERE routeParamGET='p={$parentPage->pageId}';");
while ($rData = $routeQuery->fetch_array()) {
$pageRoute = $rData["routeVal"];
}
}
if (isset($pageRoute)) {
$this->menu[$this->mainCounter][$this->subCounter]["pageAddress"] = WEBSITE_ADDRESS . substr($pageRoute, 1);
} else {
$this->menu[$this->mainCounter][$this->subCounter]["pageAddress"] = "index.php?p=" . $parentPage->pageId;
}
unset($pageRoute);
$this->menu[$this->mainCounter][$this->subCounter]["pageId"] = $parentPage->pageId;
$this->menu[$this->mainCounter][$this->subCounter]["pageTitle"] = $parentPage->pageTitle;
$subPageData = $database->Query("SELECT * FROM " . TABLE_PREFIX . "pages WHERE pageParent='{$parentPage->pageId}' ORDER BY pagePosition ASC;");
while ($subRow = $subPageData->fetch_array()) {
$subPageId = $subRow["pageId"];
$subPage = new Page();
$subPage->GetInfo($subPageId);
$this->subCounter++;
if ($database->Query("SELECT * FROM " . TABLE_PREFIX . "modules WHERE moduleName='simpleRoutes' AND moduleStatus='1';")->num_rows) {
$routeQuery = $database->Query("SELECT routeVal FROM " . TABLE_PREFIX . "m_routes WHERE routeParamGET='p={$subPage->pageId}';");
while ($rData = $routeQuery->fetch_array()) {
$pageRoute = $rData["routeVal"];
}
}
if (isset($pageRoute)) {
$this->menu[$this->mainCounter][$this->subCounter]["pageAddress"] = WEBSITE_ADDRESS . substr($pageRoute, 1);
} else {
$this->menu[$this->mainCounter][$this->subCounter]["pageAddress"] = "index.php?p=" . $subPage->pageId;
}
unset($pageRoute);
$this->menu[$this->mainCounter][$this->subCounter]["pageId"] = $subPage->pageId;
$this->menu[$this->mainCounter][$this->subCounter]["pageTitle"] = $subPage->pageTitle;
}
$this->subCounter = 0;
$this->mainCounter++;
}
return $this->menu;
}
示例9: defined
<?php
/*
* @author: Tomáš Mičulka
* @version: 2.0
* @last_update: 15.4.2014
*/
defined('IN_INNE') or die("Acces denied!");
$database = Mysql::getConnection();
$getToken = $_GET["token"];
$user = User::getInstance();
if ($user->userToken == $getToken && $user->userPerm == 5) {
$moduleId = $database->handler->real_escape_string($_POST["id"]);
$module = new Module();
$module->GetInfo($moduleId);
if ($module->moduleStatus == 1) {
$module->DisableModule();
} else {
$module->EnableModule();
}
}
示例10: DeleteRouteGet
public function DeleteRouteGet($paramGet)
{
$database = Mysql::getConnection();
//$data = $database->Query("SELECT * FROM ".TABLE_PREFIX."m_routes WHERE routeParamGet='$paramGet';");
$database->Query("DELETE FROM " . TABLE_PREFIX . "m_routes WHERE routeParamGet='{$paramGet}';");
}
示例11: SaveModule
public function SaveModule()
{
$database = Mysql::getConnection();
$database->Query("INSERT INTO " . TABLE_PREFIX . "modules VALUES (''," . " '{$this->moduleName}'," . " '{$this->moduleVersion}'," . " '{$this->moduleAuthor}'," . " '{$this->moduleDescription}'," . " '{$this->moduleType}'," . " '{$this->modulePriority}'," . " '{$this->moduleAutoStart}'," . " '{$this->moduleStatus}'," . " '{$this->moduleStyles}'," . " '{$this->moduleIcon}'," . " '{$this->moduleAdmin}'," . " '{$this->moduleAdminMenu}');");
}
示例12: LogEntry
public function LogEntry()
{
$database = Mysql::getConnection();
$details = json_decode(file_get_contents("http://ipinfo.io/"));
$clientIp = $details->ip;
$clientCity = $details->city;
$clientCountry = $details->country;
$date = time();
$data = $database->Query("SELECT * FROM " . TABLE_PREFIX . "uniqueclients WHERE clientIp='{$clientIp}' AND clientCity='{$clientCity}' AND clientCountry='{$clientCountry}';");
if ($data->num_rows == 0) {
$database->Query("INSERT INTO " . TABLE_PREFIX . "uniqueclients VALUES ('', '{$clientIp}', '{$clientCity}', '{$clientCountry}');");
}
$database->Query("INSERT INTO " . TABLE_PREFIX . "visits VALUES ('', '{$date}', '{$clientIp}', '{$clientCity}', '{$clientCountry}');");
}