当前位置: 首页>>代码示例>>PHP>>正文


PHP SQLQuery::connect方法代码示例

本文整理汇总了PHP中SQLQuery::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP SQLQuery::connect方法的具体用法?PHP SQLQuery::connect怎么用?PHP SQLQuery::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLQuery的用法示例。


在下文中一共展示了SQLQuery::connect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 private function __construct()
 {
     if (self::$_host != '' && self::$_user != '' && self::$_database != '') {
         $conn = parent::connect(self::$_host, self::$_user, self::$_password, self::$_database);
         if ($conn !== 1) {
             header("HTTP/1.0 500 Internal Server Error");
             exit("<h1>500 Internal Server Error</h1>MySQL Connection Error.");
         }
     }
 }
开发者ID:JaviereN,项目名称:CuteMVC,代码行数:10,代码来源:Model.php

示例2: callHook

/** Main Call Function **/
function callHook()
{
    if (isset($_GET['url'])) {
        $url = $_GET['url'];
    } else {
        $url = "index";
    }
    // Create the model factory
    $query = new SQLQuery();
    $query->connect('localhost', 'root', '', 'kucharka');
    $modelFactory = new ModelFactory($query);
    // Prep the controller name and the query string
    $urlArray = explode("/", $url);
    $controller = ucwords($urlArray[0]);
    array_shift($urlArray);
    $queryString = array_merge($urlArray, $_POST, $_GET);
    // Call the header controller
    $h = new Header($modelFactory, [], false);
    call_user_func_array(array($h, 'main'), []);
    // Call the page controller
    $dispatch = new $controller($modelFactory, $queryString, false);
    call_user_func_array(array($dispatch, 'main'), []);
    // If an action was sent, call the appropriate function in the controller
    if (isset($queryString['action']) && !empty($queryString['action'])) {
        if (is_string($queryString['action'])) {
            $method = $queryString['action'];
        } else {
            if (is_array($queryString['action'])) {
                list($a_key, $a_val) = each($_POST['action']);
                $method = 'btn' . ucwords($a_key) . '_Clicked';
            }
        }
        if (method_exists($dispatch, $method) && is_callable(array($dispatch, $method))) {
            call_user_func_array(array($dispatch, $method), []);
        } else {
            header("HTTP/1.0 404 Not Found");
        }
    }
    // Call the footer controller
    $f = new Footer($modelFactory, [], false);
    call_user_func_array(array($f, 'main'), []);
}
开发者ID:vgck,项目名称:archive,代码行数:43,代码来源:index.php

示例3: SQLQuery

<?php

include '../../../lib/sqlquery.class.php';
include '../../../lib/newmodel.class.php';
include '../../../app/models/Query.php';
include '../../../app/models/Settings.php';
include '../../../app/models/User.php';
include '../../../app/models/Utils.php';
$query = new SQLQuery();
$query->connect('localhost', 'root', '', 'boxarcade');
Settings::Init();
include '../../../lang/' . Settings::Get('language') . '.php';
User::sec_session_start();
User::Init();
$userid = intval($_SESSION['user_id']);
if (User::login_check(Query::$mysqli) == true) {
    //$get_comment = Query::query("SELECT * FROM tbl_comments WHERE id='" . $_POST['id'] . "'")->fetch_assoc();
    //Query::query("UPDATE tbl_users SET comments = comments - 1, points = points - $setting[points_comment] WHERE id='" . $get_comment['user'] . "'")->fetch_assoc();
    $result = Query::query("DELETE FROM tbl_comments WHERE id='" . $_POST['id'] . "'");
    echo $_POST['id'];
    echo 'Success';
} else {
    exit;
}
开发者ID:vgck,项目名称:archive,代码行数:24,代码来源:delete_comment.php

示例4: callHook

/** Main Call Function **/
function callHook()
{
    if (isset($_GET['url'])) {
        $url = $_GET['url'];
    } else {
        $url = "index";
    }
    // Create the model factory
    $query = new SQLQuery();
    $query->connect('localhost', 'root', '', 'boxarcade');
    //$modelFactory = new ModelFactory($query);
    $settings = new Settings();
    $login_check = 99;
    User::sec_session_start();
    User::Init();
    if (User::login_check(Query::$mysqli) == true) {
        $xuserid = intval($_SESSION['user_id']);
        $sql = Query::query("SELECT * FROM Players WHERE PlayerID={$xuserid}");
        $get_user_info = $sql->fetch_assoc();
        $user = array('usrLang' => $get_user_info['Language'], 'username' => $get_user_info['Username'], 'id' => intval($_SESSION['user_id']), 'points' => $get_user_info['Points'], 'login_status' => 1, 'messages' => $get_user_info['Messages'], 'seo_url' => $get_user_info['Username']);
        $user['ip'] = User::secure($_SERVER['REMOTE_ADDR']);
        // If not avatar, try to get one from fb or set a default
        if ($get_user_info['AvatarType'] == '') {
            $user['avatar'] = 'uploads/avatars/default.png';
        } else {
            $user['avatar'] = 'uploads/avatars/' . $get_user_info['PlayerID'] . $get_user_info['AvatarType'];
        }
        $user['url'] = '/boxarcade/profile/' . $get_user_info['Username'];
        $user['message_url'] = 'messages';
        $user['admin'] = $get_user_info['Admin'];
        $login_check = 1;
        // Update the user IP if this is a new session
        if (!isset($_COOKIE['ava_iptrack'])) {
            Query::query("UPDATE Players SET LastIP = '{$user['ip']}' WHERE PlayerID = {$user['id']}") or die(mysql_error());
            setcookie("iptrack", '1');
        }
    } else {
        $user['login_status'] = 0;
        $user['admin'] = 0;
    }
    // Prep the controller name and the query string
    $urlArray = explode("/", $url);
    $controller = ucwords($urlArray[0]);
    array_shift($urlArray);
    $queryString = array_merge($urlArray, $_POST, $_GET);
    // Call the header controller
    $h = new Header($modelFactory, [], true);
    call_user_func_array(array($h, 'main'), [$login_check, $user]);
    // Call the page controller
    $dispatch = new $controller($modelFactory, $queryString, false);
    call_user_func_array(array($dispatch, 'main'), [$user]);
    // If an action was sent, call the appropriate function in the controller
    if (isset($queryString['action']) && !empty($queryString['action'])) {
        if (is_string($queryString['action'])) {
            $method = $queryString['action'];
        } else {
            if (is_array($queryString['action'])) {
                list($a_key, $a_val) = each($_POST['action']);
                $method = 'btn' . ucwords($a_key) . '_Clicked';
            }
        }
        if (method_exists($dispatch, $method) && is_callable(array($dispatch, $method))) {
            call_user_func_array(array($dispatch, $method), []);
        } else {
            header("HTTP/1.0 404 Not Found");
        }
    }
    // Call the footer controller
    $f = new Footer($modelFactory, [], true);
    call_user_func_array(array($f, 'main'), []);
}
开发者ID:vgck,项目名称:archive,代码行数:72,代码来源:index.php


注:本文中的SQLQuery::connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。