• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DBConnect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 function __construct()
 {
     require_once 'DB_Connect.php';
     // connecting to database
     $db = new DBConnect();
     $this->conn = $db->connect();
 }
开发者ID:depp1993,项目名称:LoginApplicationTest,代码行数:7,代码来源:DB_Functions.php


示例2: getCoon

 public static function getCoon()
 {
     static $conn = NULL;
     if ($conn == NULL) {
         $conn = new DBConnect();
     }
     return $conn->getCoon();
 }
开发者ID:alonexy,项目名称:lea,代码行数:8,代码来源:DBTool.php


示例3: getTableBody

function getTableBody($tid, $datesCoordination)
{
    $tableBody = '';
    if (isset($tid) == false && isset($datesCoordination) == false) {
        $tableBody .= '<tr><td><input type="datetime-local" class="form-control" oninput="addNewLine()"/></td>';
        $tableBody .= '<td>';
        $tableBody .= '<select class="form-control" required>-';
        $tableBody .= '<option value="0">Ja</option>';
        $tableBody .= '<option value="1">Nein</option>';
        $tableBody .= '<option value="2">Vielleicht</option>';
        $tableBody .= '</select>';
        $tableBody .= '</td>';
        $tableBody .= '<td>';
        $tableBody .= '</td>';
        $tableBody .= '</tr>';
        return $tableBody;
    }
    $dbc = new DBConnect();
    $userVotes = $dbc->loadUsersVotes_db($tid, $_SESSION['userid']);
    if (count($userVotes) > 0) {
        foreach ($userVotes as $vote) {
            $v = $vote->getVote();
            $tableBody .= '<tr><td><input type="datetime-local" class="form-control" readonly value="' . date_format($vote->getDate(), "Y-m-d\\TH:i") . '"/></td>';
            $tableBody .= '<td>';
            $tableBody .= '<select class="form-control" required>-';
            $tableBody .= '<option value="0" ' . ($v == 'Ja' ? 'selected' : '') . '>Ja</option>';
            $tableBody .= '<option value="1" ' . ($v == 'Nein' ? 'selected' : '') . '>Nein</option>';
            $tableBody .= '<option value="2" ' . ($v == 'Vielleicht' ? 'selected' : '') . '>Vielleicht</option>';
            $tableBody .= '</select>';
            $tableBody .= '</td>';
            $tableBody .= '<td>';
            $tableBody .= '</td>';
            $tableBody .= '</tr>';
        }
    } else {
        if (isset($datesCoordination)) {
            $dateVotes = $datesCoordination->getResults();
            foreach ($dateVotes as $vote) {
                $tableBody .= '<tr><td><input type="datetime-local" class="form-control" readonly value="' . date_format($vote->getDate(), "Y-m-d\\TH:i") . '"/></td>';
                $tableBody .= '<td>';
                $tableBody .= '<select class="form-control" required>-';
                $tableBody .= '<option value="0">Ja</option>';
                $tableBody .= '<option value="1">Nein</option>';
                $tableBody .= '<option value="2">Vielleicht</option>';
                $tableBody .= '</select>';
                $tableBody .= '</td>';
                $tableBody .= '<td>';
                $tableBody .= '</td>';
                $tableBody .= '</tr>';
            }
        }
    }
    return $tableBody;
}
开发者ID:Chr1st1anSzech,项目名称:Terminfindung-Maturitas,代码行数:54,代码来源:termin_planen_get.php


示例4: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new DBConnect();
     }
     return self::$instance;
 }
开发者ID:php2code,项目名称:School,代码行数:7,代码来源:class.dbConnect.php


示例5: getInstance

 public static function getInstance()
 {
     if (!isset(DBConnect::$db)) {
         DBConnect::$db = new DBConnect();
     }
     return DBConnect::$db->dbh;
 }
开发者ID:Mwalima,项目名称:databank,代码行数:7,代码来源:DBConnection.php


示例6: action

 public function action()
 {
     require_once "dbconnect.php";
     // チェックポイント名の取り出し
     // パラメータ取り出し用のクラス作成の予定から変更の可能性あり
     $params = $_GET['point'];
     // データベースコネクションクラスの作成
     $dbConnect = new DBConnect();
     // チェックポイントデータの取り出し
     $pointData = $dbConnect->getPointData($params);
     // 出力用変数への割り当て
     $out['sign'] = $pointData['sign'];
     $out['name'] = $pointData['name'];
     // Skinnyを使用しての値のバインド
     $Skinny->SkinnyDisplay("Check-Point-Temp.html", $out);
 }
开发者ID:pochiMasahiro,项目名称:NewStampRally,代码行数:16,代码来源:dispatch-point.php


示例7: showGemeenteNaam

 public function showGemeenteNaam()
 {
     $db_handle = DBConnect::getInstance();
     $sqlJaar = "SELECT naam FROM Jeugd_Gemeentenaam";
     $stmt = $db_handle->prepare($sqlJaar);
     $stmt->execute();
     $result = $stmt->fetchAll(PDO::FETCH_COLUMN);
 }
开发者ID:Mwalima,项目名称:databank,代码行数:8,代码来源:GemeenteNaam.php


示例8: __construct

 public function __construct($x, $y)
 {
     $db_handle = DBConnect::getInstance();
     $aantalJongeren = new aantalJongeren($db_handle);
     $jaar = $aantalJongeren->showJaren();
     $this->xAx_Points = $jaar;
     $this->yAx_Points = $_POST['PrognoseJongeren'];
 }
开发者ID:Mwalima,项目名称:databank,代码行数:8,代码来源:RegressionTotaalAantalJongerenGemeente.php


示例9: getRedisServer

 public static function getRedisServer()
 {
     if (null === self::$_instance) {
         self::$_instance = new Redis();
         self::$_instance->connect(DBConnectConfig::HOST, DBConnectConfig::PORT);
     }
     return self::$_instance;
 }
开发者ID:JamzyWang,项目名称:ACKQueue,代码行数:8,代码来源:DBConnect.php


示例10: __construct

 public function __construct($x, $y)
 {
     $db_handle = DBConnect::getInstance();
     $aantalJongeren = new aantalJongeren($db_handle);
     $jaar = $aantalJongeren->showJaren();
     $this->xAx_Points = $jaar;
     $totaalnieuweClienten = $aantalJongeren->showAantalNieuweClienten();
     $this->yAx_Points = $totaalnieuweClienten;
 }
开发者ID:Mwalima,项目名称:databank,代码行数:9,代码来源:RegressionNieuweClienten.php


示例11: delMessage

 public function delMessage($imageId)
 {
     $redis = DBConnect::getRedisServer();
     $ret = $redis->lRem(KeyNamespace::FAILED_QUEUE, $imageId, 1);
     if (false == $ret) {
         print "failed to delete message from failed queue\n";
         return false;
     }
     return true;
 }
开发者ID:JamzyWang,项目名称:ACKQueue,代码行数:10,代码来源:DBFailedQueue.php


示例12: checkLogin

 public function checkLogin($user, $pw)
 {
     $db = new DBConnect();
     $mysql = $db->connect();
     $sql = "SELECT * FROM user WHERE nickname = '" . $user . "' AND pw = '" . sha1($pw) . "'";
     $result = $mysql->query($sql);
     if ($mysql->affected_rows == 1) {
         $row = $result->fetch_assoc();
         $_SESSION['nickname'] = $row['nickname'];
         $_SESSION['firstname'] = $row['firstname'];
         $_SESSION['lastname'] = $row['lastname'];
         $_SESSION['email'] = $row['email'];
         $_SESSION['loggedin'] = true;
         $db->close();
         return true;
     }
     $db->close();
     return false;
 }
开发者ID:nxnc,项目名称:WPF_MW,代码行数:19,代码来源:login.php


示例13: ackMessage

 public static function ackMessage($message)
 {
     $redis = DBConnect::getRedisServer();
     $ret = $redis->lRem(KeyNamespace::UN_ACK_QUEUE, $message, 1);
     if (false == $ret) {
         print "failed to ackMessage\n";
         return false;
     }
     return true;
 }
开发者ID:JamzyWang,项目名称:ACKQueue,代码行数:10,代码来源:DBUnACKQueue.php


示例14: update

 public function update($con_id, $username, $phone, $email)
 {
     $db = DBConnect::getInstance();
     $sql = "UPDATE {$this->table} SET \r\n\t\t\t\t\tusername=:username,\r\n\t\t\t\t\tphone=:phone, \r\n\t\t\t\t\temail=:email \r\n\t\t\t\t\tWHERE id=:con_id";
     $stmt = $db->prepare($sql);
     $stmt->bindValue(':username', $username);
     $stmt->bindValue(':phone', $phone);
     $stmt->bindValue(':email', $email);
     $stmt->bindValue(':con_id', $con_id);
     return $stmt->execute();
 }
开发者ID:nixwins,项目名称:test_task,代码行数:11,代码来源:contact_model.php


示例15: __construct

 public function __construct($x, $y)
 {
     $db_handle = DBConnect::getInstance();
     $jaarJongeren = new aantalJongeren($db_handle);
     $jaar = $jaarJongeren->showJaren();
     //        $laatsteDrieJaren = array_slice($jaar, 2,3);
     $this->xAx_Points = $jaar;
     $aantalJongeren = new JeugdZorgProvincie($db_handle);
     $percentageJongeren = $aantalJongeren->showPercentageNieuweClienten();
     //$percentageLaatsteDrieJaren = array_slice($percentageJongeren, 2,3);
     $this->yAx_Points = $percentageJongeren;
 }
开发者ID:Mwalima,项目名称:databank,代码行数:12,代码来源:RegressionJeugdZorgProvincie.php


示例16: __construct

 public function __construct(DBConnect $dbConnect)
 {
     $this->dbConnect = $dbConnect;
     try {
         parent::__construct('mysql:host=' . $dbConnect->getHost() . ';dbname=' . $dbConnect->getDatabase() . ($dbConnect->getCharset() !== null ? ';charset=' . $dbConnect->getCharset() : null), $dbConnect->getUsername(), $dbConnect->getPassword());
         $this->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
         $this->setAttribute(\PDO::ATTR_EMULATE_PREPARES, false);
         if (($charset = $dbConnect->getCharset()) !== null) {
             $this->query("SET NAMES '" . $charset . "'");
             $this->query("SET CHARSET '" . $charset . "'");
         }
         $this->triggerListeners('onConnect', array($this, $this->dbConnect));
     } catch (\PDOException $e) {
         throw new DBException($e);
     }
 }
开发者ID:timesplinter,项目名称:tsfw-db,代码行数:16,代码来源:DBMySQL.php


示例17: __construct

 public function __construct($x, $y)
 {
     $db_handle = DBConnect::getInstance();
     $jaarJongeren = new aantalJongeren($db_handle);
     $jaar = $jaarJongeren->showJaren();
     // $laatsteDrieJaren = array_slice($jaar, 2,3);
     $this->xAx_Points = $jaar;
     $verhoudingen = new ProcentueleVerhoudingen($db_handle);
     $percentageJongeren = $verhoudingen->showPercentagenieuweClientenJeugdGGZ();
     //$percentageLaatsteDrieJaren = array_slice($percentageJongeren, 2,3);
     $percentageLaatsteDrieJaren = $percentageJongeren;
     //var_dump($percentageLaatsteDrieJaren);
     $this->yAx_Points = $percentageLaatsteDrieJaren;
 }
开发者ID:Mwalima,项目名称:databank,代码行数:14,代码来源:RegressieNieuweClientenCategorieJeugdGGZ.php


示例18: registerNewUser

 /**
  * handles the entire registration process. checks all error possibilities
  * and creates a new user in the database if everything is fine
  */
 private function registerNewUser()
 {
     if (empty($_POST['user_name'])) {
         $this->errors[] = "Empty Username";
     } elseif (empty($_POST['user_password_new']) || empty($_POST['user_password_repeat'])) {
         $this->errors[] = "Empty Password";
     } elseif ($_POST['user_password_new'] !== $_POST['user_password_repeat']) {
         $this->errors[] = "Password and password repeat are not the same";
     } elseif (strlen($_POST['user_password_new']) < 6) {
         $this->errors[] = "Password has a minimum length of 6 characters";
     } elseif (strlen($_POST['user_name']) > 64 || strlen($_POST['user_name']) < 2) {
         $this->errors[] = "Username cannot be shorter than 2 or longer than 64 characters";
     } elseif (!preg_match('/^[a-z\\d]{2,64}$/i', $_POST['user_name'])) {
         $this->errors[] = "Username does not fit the name scheme: only a-Z and numbers are allowed, 2 to 64 characters";
     } elseif (empty($_POST['user_email'])) {
         $this->errors[] = "Email cannot be empty";
     } elseif (strlen($_POST['user_email']) > 64) {
         $this->errors[] = "Email cannot be longer than 64 characters";
     } elseif (!filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)) {
         $this->errors[] = "Your email address is not in a valid email format";
     } elseif (!empty($_POST['user_name']) && strlen($_POST['user_name']) <= 64 && strlen($_POST['user_name']) >= 2 && preg_match('/^[a-z\\d]{2,64}$/i', $_POST['user_name']) && !empty($_POST['user_email']) && strlen($_POST['user_email']) <= 64 && filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL) && !empty($_POST['user_password_new']) && !empty($_POST['user_password_repeat']) && $_POST['user_password_new'] === $_POST['user_password_repeat']) {
         // create a database connection
         try {
             $this->db_connection = DBConnect::getConnection();
         } catch (Exception $e) {
             $this->errors[] = $e->getMessage();
             return;
         }
         // remove everything that could be (html/javascript-) code
         $user_name = strip_tags($_POST['user_name'], ENT_QUOTES);
         $user_email = strip_tags($_POST['user_email'], ENT_QUOTES);
         $user_password = $_POST['user_password_new'];
         // crypt the user's password with PHP 5.5's password_hash() function, results in a 60 character
         // hash string. the PASSWORD_DEFAULT constant is defined by the PHP 5.5, or if you are using
         // PHP 5.3/5.4, by the password hashing compatibility library
         $user_password_hash = password_hash($user_password, PASSWORD_DEFAULT);
         $user_exists_statement = $this->db_connection->prepare("SELECT user_id FROM users WHERE user_name = :user_name OR user_email = :user_email");
         $user_exists_statement->execute(array('user_name' => $user_name, 'user_email' => $user_email));
         if ($user_exists_statement->rowCount() > 0) {
             $this->errors[] = "Sorry, that username / email address is already taken.";
         } else {
             $insert_user_statement = $this->db_connection->prepare("\r\n                  INSERT INTO users (user_name, user_password_hash, user_email)\r\n                  VALUES (:user_name, :user_password_hash, :user_email)\r\n                ");
             $insert_user_statement->execute(array('user_name' => $user_name, 'user_password_hash' => $user_password_hash, 'user_email' => $user_email));
             $this->messages[] = "Your account has been created successfully. You can now log in.";
         }
     } else {
         $this->errors[] = "An unknown error occurred.";
     }
 }
开发者ID:pfidr34,项目名称:Bootstrap-Nest-Administration-Tool,代码行数:53,代码来源:registration.php


示例19: __construct

 public function __construct($x, $y)
 {
     $db_handle = DBConnect::getInstance();
     $aantalJongeren = new aantalJongeren($db_handle);
     $jaar = $aantalJongeren->showJaren();
     $this->xAx_Points = $jaar;
     $var_array = $_POST['arrayAantalNieuweClienten'];
     foreach ($var_array as $key => $array) {
     }
     for ($i = 0; $i <= count($var_array); $i++) {
         if ($var_array[$i] == 0) {
         }
     }
     array_splice($var_array, $var_array[$i], 1);
     $this->yAx_Points = $var_array;
 }
开发者ID:Mwalima,项目名称:databank,代码行数:16,代码来源:RegressionNieuweClientenGemeente.php


示例20: __construct

 public function __construct($x, $y)
 {
     $db_handle = DBConnect::getInstance();
     $jaarJongeren = new aantalJongeren($db_handle);
     $jaar = $jaarJongeren->showJaren();
     $this->xAx_Points = $jaar;
     //verwijder alle elementen die geen waarde of een ander datatype hebben
     $var_array = $_POST['arrayPercentage'];
     foreach ($var_array as $key => $array) {
     }
     for ($i = 0; $i <= count($var_array); $i++) {
         if ($var_array[$i] == 0) {
         }
     }
     array_splice($var_array, $var_array[$i], 1);
     $this->yAx_Points = $var_array;
 }
开发者ID:Mwalima,项目名称:databank,代码行数:17,代码来源:RegressionPercentageNieuweClientenGemeente.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DBConnection类代码示例发布时间:2022-05-23
下一篇:
PHP DBC类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap