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


PHP Connect函数代码示例

本文整理汇总了PHP中Connect函数的典型用法代码示例。如果您正苦于以下问题:PHP Connect函数的具体用法?PHP Connect怎么用?PHP Connect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: get_pages

 public static function get_pages($lang = FALSE)
 {
     if ($lang == FALSE) {
         $lang = Settings::get_lang();
     }
     $pages = self::$ci->page_model->get_lang_list(false, $lang);
     // Should never be displayed : no pages are set.
     if (empty($pages)) {
         show_error('Internal error : <b>No pages found.</b><br/>Solution: <b>Create at least one online page.</b>', 500);
         exit;
     }
     /* Spread authorizations from parents pages to chidrens.
      * This adds the group ID to the childrens pages of a protected page
      * If you don't want this, just uncomment this line.
      */
     if (Connect()->logged_in()) {
         self::$user = Connect()->get_current_user();
     }
     self::$ci->page_model->spread_authorizations($pages);
     // Filter pages regarding the authorizations
     $pages = array_values(array_filter($pages, array(__CLASS__, '_filter_pages_authorization')));
     // Set all abolute URLs one time, for perf.
     self::init_absolute_urls($pages, $lang);
     return $pages;
 }
开发者ID:BGCX261,项目名称:zillatek-project-svn-to-git,代码行数:25,代码来源:Pages.php

示例2: UpdateUser

function UpdateUser($config, $id, $data)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = "UPDATE user SET ";
            foreach ($data as $key => $value) {
                echo "<pre>key:";
                print_r($key);
                echo "</pre>";
                echo "<pre>value:";
                print_r($value);
                echo "</pre>";
            }
            die;
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/Delete.php';
            $rows = Update($id, $data, $config['userfilename']);
            break;
    }
    return $rows;
}
开发者ID:rubenpeciv,项目名称:kaka,代码行数:27,代码来源:UpdateUser.php

示例3: insertion_Genre

function insertion_Genre($Genre)
{
    $pdo = Connect();
    foreach ($Genre as $val) {
        $sql_search = "SELECT `genres` FROM 'name' WHERE `genres`.'name'=" . $val;
    }
}
开发者ID:CPNV-ES,项目名称:movies,代码行数:7,代码来源:lib_mymoviedb.php

示例4: Query

function Query($query)
{
    global $connected;
    if (!$connected) {
        Connect();
    }
    $result = mysql_query($query) or die(mysql_error());
    return $result;
}
开发者ID:etodd,项目名称:a3p,代码行数:9,代码来源:db.php

示例5: dumpDB

function dumpDB()
{
    $link = Connect();
    $query = $link->prepare("SELECT word,answer  FROM ia_dictionary");
    // change to match your db
    $query->execute();
    $res = $query->fetchall(PDO::FETCH_ASSOC);
    return $res;
}
开发者ID:robindevouge,项目名称:IA,代码行数:9,代码来源:getDictionary.php

示例6: jobList

function jobList()
{
    include 'connect.php';
    $conn = Connect();
    $list = $conn->query("SELECT * FROM JOB_TITLE JOIN DEPARTMENT ON dept_id = DEPARTMENT_dept_id");
    while ($row = $list->fetch_assoc()) {
        echo "<option value='" . $row['job_id'] . "'>" . $row['job_title'] . " - " . $row['dept_name'] . "</option>";
    }
    $conn->close();
}
开发者ID:ptcarino,项目名称:advweb1ex1,代码行数:10,代码来源:lists.php

示例7: premierepage

function premierepage()
{
    $dbh = Connect();
    $sql = "SELECT nom\n\t\t\tfrom utilisateur";
    $query = $dbh->query($sql);
    if ($query) {
        return $query->fetchAll();
    } else {
        return false;
    }
}
开发者ID:joelBanka,项目名称:CharismaJNM,代码行数:11,代码来源:db.php

示例8: SyncServers

function SyncServers()
{
    $sync = new articaSMTPSync();
    if (!is_array($sync->serverList)) {
        writelogs("No servers aborting", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    while (list($server, $array) = each($sync->serverList)) {
        $port = $array["PORT"];
        $user = $array["user"];
        $password = $array["password"];
        Connect($server, $port, $user, $password);
    }
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:14,代码来源:exec.smtp.export.users.php

示例9: InsertUser

function InsertUser($config, $data, $filename)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = 'INSERT INTO user (iduser, name, email, password, photo, description, bdate, city_idcity, gender_idgender) VALUES ' . '("4", "' . $data['name'] . '", "' . $data['email'] . '", "' . $data['password'] . '", "' . $_FILES['photo']['name'] . '", "' . $data['description'] . '", "' . $data['bdate'] . '", 1, 1)';
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include "../modules/Application/src/Application/Model/Txt/Insert.php";
            Insert($_POST, $filename);
            break;
    }
    // Obtener nombre de la imagen subida
    $_POST['photo'] = $_FILES['photo']['name'];
    // Comprobar si el nombre de archivo existe
    $dir = $_SERVER['DOCUMENT_ROOT'] . '/img/';
    $files = scandir($dir);
    if (in_array($_POST['photo'], $files)) {
        // Si existe se concatena con un numero
        // Comprobar si hay algun otro archivo con el mismo nombre y un numero concatenado
        $filtrado = "/" . substr($_POST['photo'], 0, -4) . "*/";
        $extension = substr($_POST['photo'], -3);
        $filesMatch = array();
        foreach ($files as $archivo) {
            $ext2 = substr($archivo, -3);
            if (preg_match($filtrado, $archivo) && $extension === $ext2) {
                $filesMatch[] = (int) substr($archivo, strrpos($archivo, "_") + 1, strlen($archivo));
            }
        }
        $filesMatchAux = range(1, max($filesMatch));
        $missing = array_diff($filesMatchAux, $filesMatch);
        if (count($missing) > 0) {
            $_POST['photo'] = substr($_POST['photo'], 0, -4) . '_' . min($missing) . '.' . $extension;
        } else {
            $_POST['photo'] = substr($_POST['photo'], 0, -4) . '_' . (max($filesMatch) + 1) . '.' . $extension;
        }
    }
    // Declarar destino donde guardar la imagen
    $destination = $_SERVER['DOCUMENT_ROOT'] . '/img/' . $_POST['photo'];
    // Pasarla de ruta temporal a ruta fisica en el servidor
    move_uploaded_file($_FILES['photo']['tmp_name'], $destination);
    return $rows;
}
开发者ID:rubenpeciv,项目名称:kaka,代码行数:47,代码来源:InsertUser.php

示例10: saveSeats

function saveSeats($seats)
{
    clearTableSeats();
    $conn = Connect();
    if ($seats) {
        foreach ($seats as $seat) {
            $seatAvailable = $seat['seatAvailable'];
            if ($seatAvailable == 'x') {
                $seatAvailable = 0;
            }
            $seatNumber = $seat['seatNumber'];
            $sql = "INSERT INTO seats \n        (seatAvailable,seatNumber)\n        VALUES \n        ({$seatAvailable},{$seatNumber})";
            $conn->query($sql);
        }
        $conn->close();
    }
}
开发者ID:jschouwstra,项目名称:php-snippets,代码行数:17,代码来源:functions.php

示例11: DeleteUser

function DeleteUser($config, $id)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = "DELETE FROM user WHERE iduser=" . $id;
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/Delete.php';
            $rows = Delete($id, $config['userfilename']);
            break;
    }
    return $rows;
}
开发者ID:rubenpeciv,项目名称:kaka,代码行数:18,代码来源:DeleteUser.php

示例12: GetUsers

function GetUsers($config)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/connect.php';
            include '../modules/Application/src/Application/Model/Mysql/Select.php';
            $link = Connect($config['slave']);
            $query = "SELECT * FROM user";
            $rows = Select($link, $query);
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/Select.php';
            $rows = Select($config['userfilename']);
            break;
    }
    return $rows;
}
开发者ID:ismaelmelus,项目名称:home,代码行数:18,代码来源:GetUsers.php

示例13: DeleteUser

function DeleteUser($config, $id)
{
    switch ($config['adapter']) {
        case 'Mysql':
            include "../modules/Application/src/Application/Model/Mysql/Connect.php";
            include "../modules/Application/src/Application/Model/Mysql/Execute.php";
            $master = $config['dbmaster'];
            $slave = $config['dbslave'];
            $link = Connect($master);
            $query = "DELETE FROM user WHERE iduser='" . $id . "'";
            $data = Execute($query, $link);
            break;
        case 'Txt':
            include "../modules/Application/src/Application/Model/Txt/Delete.php";
            $data = Delete($config['filename'], $id);
            break;
    }
    return $data;
}
开发者ID:agustincl,项目名称:zgz2015_t,代码行数:19,代码来源:DeleteUser.php

示例14: GetUsers

function GetUsers($config)
{
    switch ($config['adapter']) {
        case 'Mysql':
            include "../modules/Application/src/Application/Model/Mysql/Connect.php";
            include "../modules/Application/src/Application/Model/Mysql/Select.php";
            $master = $config['dbmaster'];
            $slave = $config['dbslave'];
            $link = Connect($master);
            $query = "SELECT * FROM user";
            $data = Select($query, $link);
            break;
        case 'Txt':
            include "../modules/Application/src/Application/Model/Txt/Select.php";
            $data = Select($config['filename']);
            break;
    }
    return $data;
}
开发者ID:agustincl,项目名称:zgz2015_t,代码行数:19,代码来源:GetUsers.php

示例15: GetUser

function GetUser($config, $id)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/connect.php';
            include '../modules/Application/src/Application/Model/Mysql/Select.php';
            $link = Connect($config['slave']);
            $query = "SELECT * FROM user WHERE iduser=" . $id;
            $rows = Select($link, $query);
            return $rows[0];
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/SelectOne.php';
            $rows = SelectOne($config['userfilename'], $id);
            return $rows;
            break;
    }
}
开发者ID:rubenpeciv,项目名称:kaka,代码行数:19,代码来源:GetUser.php


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