本文整理汇总了PHP中DBConnect::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP DBConnect::connect方法的具体用法?PHP DBConnect::connect怎么用?PHP DBConnect::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBConnect
的用法示例。
在下文中一共展示了DBConnect::connect方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DBConnect
function __construct()
{
require_once 'DB_Connect.php';
// connecting to database
$db = new DBConnect();
$this->conn = $db->connect();
}
示例2: 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;
}
示例3: DBConnect
<?php
require_once '../db.php';
$db = new DBConnect();
$con = $db->connect();
if (!is_null($con)) {
$rawdata = file_get_contents('php://input');
$obj = json_decode($rawdata);
if (isset($obj->id_payment)) {
$query = sprintf("delete from payment where id = '%s'", $con->real_escape_string($obj->id_payment));
$result = $con->query($query);
if ($result) {
header("HTTP/1.1 200 OK");
} else {
header("HTTP/1.1 500 Internal Server Error");
}
} else {
header("HTTP/1.1 500 Internal Server Error");
}
} else {
header("HTTP/1.1 500 Internal Server Error");
}
示例4: __construct
function __construct()
{
$data = array('host' => 'localhost', 'db' => 'test', 'user' => 'root', 'pwd' => '');
$this->_c = DBConnect::connect($data);
}
示例5: DBConnect
public static final function _Connect(){
$db = new DBConnect();
$db->connect(self::PUBLIC_SERVER, self::PUBLIC_ENTRY, self::PUBLIC_PASS, self::PUBLIC_DATABASE);
return $db;
}
示例6: DBConnect
<?php
// 데이터베이스에 레코드를 수정하는 페이지
include "dbConnect.php";
error_reporting(E_ALL);
ini_set("display_errors", 1);
$subject = $_POST["subject"];
// POST 변수로 제목 변수 받아옴
$content = $_POST["content"];
// POST 변수로 내용 변수 받아옴
$num = $_POST["num"];
// POST 변수로 번호 변수 받아옴
$ip = $_SERVER["REMOTE_ADDR"];
// 클라이언트 IP 받아옴
$db = new DBConnect();
$db->connect();
$query = "update dictionary set subject = '{$subject}', content = '{$content}', ip = '{$ip}', regdate = now() where num = {$num};";
// DB에서 레코드를 수정하기 위한 쿼리문
mysql_query($query);
// 쿼리문 실행
$db->disconnect();
示例7: GetDefaultConnection
/**
*
* @global DBConnect $__conn
* @return DBConnect
*/
public static function GetDefaultConnection()
{
static $__conn;
require_once FCORE_FILE_DBCONNECT;
if ($__conn == null)
{
$__conn = new DBConnect(self::$GLOBAL_LOGGER);
}
if (!$__conn->isConnected())
{
$__conn->connect(self::$DB_DEFAULT_HOST,
self::$DB_DEFAULT_USER,
self::$DB_DEFAULT_PASS,
self::$DB_DEFAULT_DB);
}
return $__conn;
}