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


PHP get_connection函数代码示例

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


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

示例1: update_product

function update_product($name, $type, $price, $description, $logo, $id)
{
    $db_connection = get_connection();
    $query = "UPDATE products SET name='{$name}', type='{$type}', price='{$price}', description='{$description}', logo='{$logo}' WHERE id='{$id}'";
    mysqli_query($db_connection, $query);
    mysqli_close($db_connection);
}
开发者ID:serhiynikolskiy,项目名称:dvsoft,代码行数:7,代码来源:db.php

示例2: db_query

/**
 * Выполняет SQL-запрос (INSERT/UPDATE/DELETE/REPLACE/ALTER/...).
 *
 * @param string $query SQL-запрос
 * @param array $params Список именованных параметров и их значений, например: array(':email' => 'foo@bar.com')
 *
 * @return int Количество затронутых строк (сколько строк было вставлено или изменено или удалено в таблице)
 */
function db_query($query, $params = array())
{
    /** @var PDO $pdo */
    $pdo = get_connection();
    $statement = $pdo->prepare($query);
    $statement->execute($params);
    return $statement->rowCount();
}
开发者ID:alpharder,项目名称:learn-ecommerce,代码行数:16,代码来源:db.php

示例3: data_edit_setting

function data_edit_setting($config, $name, $value)
{
    // get connection
    $conn = get_connection($config);
    // create the SQL statement
    $sql = "UPDATE setting \n\t\t\tSET Value = '{$value}'\n\t\t\tWHERE name = '{$name}'";
    // execute the SQL statement
    return mysql_query($sql, $conn) or die(mysql_error());
}
开发者ID:NguyenThanhDung,项目名称:Finance,代码行数:9,代码来源:data_setting.php

示例4: __construct

 /**
  * PersonaModel constructor.
  * @param $persona
  */
 public function __construct(Persona $persona = null)
 {
     if ($persona) {
         $this->persona = $persona;
     }
     $this->connecion = get_connection();
     $this->connecion->selectDB("test");
     $this->CPersona = $this->connecion->selectCollection("test", "persona");
     //selecciona la coleccion
 }
开发者ID:jdla1990,项目名称:PhpAngularMongo,代码行数:14,代码来源:persona_model.inc.php

示例5: store_on_temp_table

 public function store_on_temp_table()
 {
     $id_last_trajectory = get_last_id_trajectory();
     $connection = get_connection();
     $sql_insert_fix = sprintf($this->sql_insert_fix_temp_table, $id_last_trajectory, $this->latitude, $this->longitude, $this->timestamp, $this->accuracy);
     $connection->query($sql_insert_fix);
     if ($connection->error) {
         die('Could not store fix' . $connection->error);
     }
     $connection->close();
 }
开发者ID:s0lver,项目名称:ServerSide-LocalPOI-Experiment,代码行数:11,代码来源:GpsFix.php

示例6: store

 public function store()
 {
     $id_last_trajectory = get_last_id_trajectory();
     $sql_insert_staypoint = sprintf($this->sql_insert_staypoint, $id_last_trajectory, $this->latitude, $this->longitude, $this->arrival_time, $this->departure_time, $this->fixes_involved);
     $connection = get_connection();
     $connection->query($sql_insert_staypoint);
     if ($connection->error) {
         die('Could not store staypoint' . $connection->error);
     }
     $connection->close();
 }
开发者ID:s0lver,项目名称:ServerSide-LocalPOI-Experiment,代码行数:11,代码来源:Staypoint.php

示例7: dump_query

function dump_query($q, $array = NULL, $tableclass = NULL)
{
    $Connection = get_connection();
    $s = $Connection->prepare($q);
    if (is_null($array)) {
        $s->execute();
    } else {
        $s->execute($array);
    }
    return dump_result($s, $tableclass);
}
开发者ID:amoschou,项目名称:acet,代码行数:11,代码来源:sqlinteraction.php

示例8: del_user

function del_user($user_id)
{
    if (!($db_link = get_connection())) {
        return -1;
    }
    $sql = 'delete from user where id=' . $user_id;
    if (mysqli_query($db_link, $sql)) {
        mysqli_close($db_link);
        return 1;
    } else {
        mysqli_close($db_link);
        return -2;
    }
}
开发者ID:EVECP,项目名称:sailing,代码行数:14,代码来源:register.php

示例9: handle_put

function handle_put($conversation)
{
    // Note: You can only "consume" the entity once, so if we want it
    // as text, and want to refer to it more than once, we should keep
    // a reference to that text.
    $text = $conversation->entity->getText();
    $note = json_decode($text, true);
    $connection = get_connection();
    try {
        add_note($note, $connection);
        update_board_timestamp($note, $connection);
    } catch (Exception $x) {
        $connection->close();
        throw $x;
    }
    $connection->close();
    return handle_get($conversation);
}
开发者ID:alanpaulin,项目名称:prudence,代码行数:18,代码来源:default.m.php

示例10: list_users

function list_users()
{
    $dbh = get_connection($GLOBALS['db_access_info_daityo']);
    if ($dbh == false) {
        error_exit("データベースに接続できません。理由: {$php_errormsg}");
    } else {
        //error_exit("データベースに接続できました。");
    }
    $sql = "select employeecode, employeenamekana, employeenamekanji, password, categorycode, inoutflag, email" . " from employee" . " where (status <> " . bind_param(1, PRAM_STRING) . ")" . " and categorycode in ('005', '007')" . " and (employeecode <> '998' and employeecode <> '999')" . " order by employeecode";
    $res = pg_query($dbh, $sql);
    if ($res == false) {
        error_exit("SQLの実行に失敗しました。理由: {$php_errormsg}");
    } else {
        $list = pg_fetch_all($res);
        //$list = array();
        //while($rc = pg_fetch_array($res)) {
        //    array_push($list, $rc);
        //}
        return $list;
    }
}
开发者ID:kaoru-t,项目名称:sample,代码行数:21,代码来源:sql_daityo.php

示例11: get_user_data

function get_user_data($id)
{
    $year = date('Y', strtotime("+3 months", strtotime(date('Y-m-d'))));
    $conn = get_connection();
    $r = $conn->query('select u.name name, u.email email, u.year year, un.name universe, u.first_time first_time, u.ready ready, u.admin admin,
                          l.list list, e.excluded exclusion
                          from zolken_invisiblefriend.users u
                          inner join zolken_invisiblefriend.universes un on un.id = u.universe 
                          left join zolken_invisiblefriend.lists l on u.id = l.user and l.year=' . $year . '
                          left join zolken_invisiblefriend.exclusions e on u.id = e.user and e.year=' . $year . '
                          where u.id=' . $id . ';');
    $json = null;
    if ($r && $r->num_rows > 0) {
        $row = $r->fetch_array(MYSQLI_ASSOC);
        $row['name'] = base64_decode($row['name']);
        $row['email'] = base64_decode($row['email']);
        $json = json_encode($row);
    }
    $conn->close();
    return $json;
}
开发者ID:zolken,项目名称:InvisibleFriend,代码行数:21,代码来源:mysql_connection.php

示例12: select_from

function select_from($What, $Where, $Array = NULL)
{
    $Connection = get_connection();
    if (is_null($Array)) {
        $Query = "SELECT {$What} FROM {$Where}";
        $Statement = $Connection->prepare($Query);
        //      $Statement->bindValue(':a',$What,PDO::PARAM_STR);
        //      $Statement->bindValue(':b',$Where,PDO::PARAM_STR);
        $Statement->execute();
    } else {
        $Query = "SELECT {$What} FROM {$Where}";
        $Statement = $Connection->prepare($Query);
        $Statement->execute($Array);
    }
    $Row = $Statement->fetch();
    $Statement->closeCursor();
    if ($Row !== FALSE) {
        return $Row[0];
    } else {
        return NULL;
    }
}
开发者ID:amoschou,项目名称:acet,代码行数:22,代码来源:functions.php

示例13: send_welcome_mail

function send_welcome_mail($id)
{
    $boundary = "__imafuckinggodbaby";
    $eencoded = "";
    $epass = "";
    $uu = "";
    $name = "";
    include_once '../mysql_connection.php';
    $conn = get_connection();
    $res = $conn->query("select u.name,u.email,u.password,un.name uname from zolken_invisiblefriend.users u inner join zolken_invisiblefriend.universes un on un.id = u.universe where u.id=" . $id . ";");
    if ($res && $res->num_rows > 0) {
        $row = $res->fetch_array(MYSQLI_ASSOC);
        $name = base64_decode($row['name']);
        $eencoded = $row['email'];
        $epass = $row['password'];
        $uu = $row['uname'];
    } else {
        return false;
    }
    $conn->close();
    $header = "From:no-reply@ztools.tk\r\nX-PHP-Script: PHP ztools.tk\r\nContent-Type:multipart/alternative; boundary={$boundary}\r\n\r\n";
    $plain = "--{$boundary}\r\nContent-Type:text/plain; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n" . file_get_contents('../../pages/welcome_mail.txt') . "\r\n";
    $plain = str_replace('#user#', $name, $plain);
    $html = "--{$boundary}\r\nContent-Type:text/html; charset=\"UTF-8\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n" . file_get_contents('../../pages/welcome_mail.html') . "\r\n";
    $html = str_replace('#user#', $name, $html);
    $link = "http://www.ztools.tk/php/users/active_user.php?id=" . $id . "&hash=" . md5($eencoded . $epass);
    $unsub = "http://www.ztools.tk/php/users/unsub_user.php?id=" . $id . "&hash=" . md5($eencoded . $epass);
    $plain = str_replace('#universe#', $uu, $plain);
    $plain = str_replace('#link#', $link, $plain);
    $plain = str_replace('#unsub#', $unsub, $plain);
    $html = str_replace('#universe#', $uu, $html);
    $html = str_replace('#link#', $link, $html);
    $html = str_replace('#unsub#', $unsub, $html);
    $rew = 5;
    while (!mail(base64_decode($eencoded), "Correu de confirmació", $plain . $html, $header) && $rew > 0) {
        $rew--;
    }
    return $rew > 0;
}
开发者ID:zolken,项目名称:InvisibleFriend,代码行数:39,代码来源:transactional_mail.php

示例14: send_mail

function send_mail($rem, $rew)
{
    global $year;
    $conn = get_connection();
    if ($conn->multi_query("select u.name name1, u.email email\n\t\t\t\t\t from zolken_invisiblefriend.users u\n                     where u.id=" . $rem . ";\n\t\t\t\t\t select u.id id2, u.name name2,l.list\n\t\t\t\t\t from zolken_invisiblefriend.users u\n\t\t\t\t\t left join zolken_invisiblefriend.lists l on l.user = u.id\n\t\t\t\t\t where u.id=" . $rew . ";")) {
        if ($result = $conn->store_result()) {
            $info1 = $result->fetch_array(MYSQLI_ASSOC);
        } else {
            return false;
        }
        $conn->next_result();
        if ($result = $conn->store_result()) {
            $info2 = $result->fetch_array(MYSQLI_ASSOC);
        } else {
            return false;
        }
    } else {
        return false;
    }
    send_raffle_mail(base64_decode($info1['email']), base64_decode($info1['name1']), base64_decode($info2['name2']), $info2['id2'], str_replace(';', '\\n', $info2['list']));
    $conn->close();
    return true;
}
开发者ID:zolken,项目名称:InvisibleFriend,代码行数:23,代码来源:raffle.php

示例15: define

<?php

define("ROOT", "../..");
require ROOT . "/libs/lib_list.php";
$f = array('deletar_cliente' => function () {
    $dao = new ClienteDAO(get_connection());
    $dao->deletar_cliente($_GET['cod_cliente']);
    Header("Location: listar.php?alert=success");
});
$f[$_GET['f']]();
开发者ID:ATSDevelopment,项目名称:ats_system,代码行数:10,代码来源:dao.php


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