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


PHP DBconnect函数代码示例

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


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

示例1: setUp

 /**
  * \brief initialization
  */
 protected function setUp()
 {
     global $PG_CONN;
     $sysconfig = dirname(__FILE__) . '/sysconfigDirTest';
     if (!is_callable('pg_connect')) {
         $this->markTestSkipped("php-psql not found");
     }
     $PG_CONN = DBconnect($sysconfig);
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:12,代码来源:test_common_cache.php

示例2: PrepareSQL

function PrepareSQL()
{
    $db = DBconnect();
    //if (!$db) die("Oops! Looks like you could not access main database for unknown reasons. Please try again later or contact admin.");
    mysql_select_db("tricking_dbMain", $db);
    mysql_query("SET NAMES UTF8");
    return "tricking_dbMain";
    //$MainDBConn;
}
开发者ID:rykdesjardins,项目名称:pixel-lion,代码行数:9,代码来源:SCRIPT_dbaccess.php

示例3: createOrder

function createOrder($data)
{
    $dbcon = DBconnect();
    $stmt = $dbcon->prepare("INSERT into tbl_orders (orderFName, orderLName, orderEmail, orderType, orderPlaceDateTime, orderDueDate, paid, baked, readyForPickup, pickedUp) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
    $stmt->bind_param("ssssssssss", $data['orderFName'], $data['orderLName'], $data['orderEmail'], $data['orderType'], $data['orderPlaceDateTime'], $data['orderDueDate'], $data['paid'], $data['baked'], $data['readyForPickup'], $data['pickedUp']);
    $stmt->execute();
    $id = $dbcon->insert_id;
    DBdisconnect($dbcon);
    echo $id;
}
开发者ID:brentli1,项目名称:BakeryOrders-BBMN-App,代码行数:10,代码来源:bakery_tasks.php

示例4: setUpDb

 /**
  * \brief initialization with db
  */
 protected function setUpDb()
 {
     if (!is_callable('pg_connect')) {
         $this->markTestSkipped("php-psql not found");
     }
     global $PG_CONN;
     global $DB_COMMAND;
     global $sys_conf;
     $DB_COMMAND = dirname(dirname(dirname(dirname(__FILE__)))) . "/testing/db/createTestDB.php";
     exec($DB_COMMAND, $dbout, $rc);
     $sys_conf = $dbout[0];
     $PG_CONN = DBconnect($sys_conf);
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:16,代码来源:test_common_sysconfig.php

示例5: getserviceslist

function getserviceslist()
{
    $con = DBconnect();
    $getservice = DBfetchall("SELECT serviceid,shopid,name,price FROM Service", $con);
    $Arr = array();
    foreach ($getservice as $row) {
        $row2 = DBfetchone("select name,pic,latitude,longtitude from Shop where shopid=" . $row["shopid"] . ";", $con);
        $a = array("serviceid" => $row["serviceid"], "shopname" => $row2["name"], "servicename" => $row["name"], "price" => $row["price"], "pic" => $row2["pic"], "latitude" => $row2["latitude"], "longtitude" => $row2["longtitude"]);
        //var_dump($row2);
        array_push($Arr, $a);
    }
    echo json_encode($Arr);
}
开发者ID:YuduDu,项目名称:iKnowTesting,代码行数:13,代码来源:servicelist.php

示例6: setUp

 protected function setUp()
 {
     global $PG_CONN;
     global $DB_COMMAND;
     global $DB_NAME;
     print "Starting unit test for common-pkg.php\n";
     $DB_COMMAND = "../../../testing/db/createTestDB.php";
     exec($DB_COMMAND, $dbout, $rc);
     preg_match("/(\\d+)/", $dbout[0], $matches);
     $test_name = $matches[1];
     $db_conf = $dbout[0];
     $DB_NAME = "fosstest" . $test_name;
     #$sysconfig = './sysconfigDirTest';
     $PG_CONN = DBconnect($db_conf);
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:15,代码来源:test_common_pkg.php

示例7: setUp

 protected function setUp()
 {
     if (!is_callable('pg_connect')) {
         $this->markTestSkipped("php-psql not found");
     }
     global $PG_CONN;
     global $DB_COMMAND;
     global $DB_NAME;
     print "Starting unit test for common-pkg.php\n";
     $DB_COMMAND = dirname(dirname(dirname(dirname(__FILE__)))) . "/testing/db/createTestDB.php";
     exec($DB_COMMAND, $dbout, $rc);
     preg_match("/(\\d+)/", $dbout[0], $matches);
     $test_name = $matches[1];
     $db_conf = $dbout[0];
     $DB_NAME = "fosstest" . $test_name;
     #$sysconfig = './sysconfigDirTest';
     $PG_CONN = DBconnect($db_conf);
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:18,代码来源:test_common_pkg.php

示例8: getCountryCode

function getCountryCode()
{
    $ip = getIp();
    // debug:
    // $ip = "193.51.208.14"; // French IP
    // $ip = "71.164.115.181"; // US IP
    $location = null;
    if ($ip) {
        // db credentials, see db.php.example
        require 'db.php';
        DBconnect($server, $username, $password, $database);
        $location = ipRoughLocate($ip);
    }
    if (!$location || !$location["countryCode"] || $location["countryName"] == "(Unknown Country?)") {
        return "US";
    } else {
        return $location["countryCode"];
    }
}
开发者ID:4ln6lambn,项目名称:christmas,代码行数:19,代码来源:iic.php

示例9: __construct

 function __construct($dbName = null, $sysConf = null)
 {
     $dbName = strtolower($dbName);
     $testDbFactory = new \TestDbFactory();
     $this->sys_conf = $sysConf;
     if (empty($this->sys_conf)) {
         $this->sys_conf = $testDbFactory->setupTestDb($dbName);
         $dbName = $testDbFactory->getDbName($this->sys_conf);
     }
     $this->dbName = $dbName;
     require_once dirname(dirname(__FILE__)) . '/common-db.php';
     $this->connection = DBconnect($this->sys_conf);
     require dirname(dirname(__FILE__)) . '/common-container.php';
     global $container;
     $logger = new Logger('default');
     // $container->get('logger');
     $this->logFileName = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . 'db.pg.log';
     $logger->pushHandler(new StreamHandler($this->logFileName, Logger::DEBUG));
     $container->get('db.manager')->setDriver(new Postgres($this->connection));
     $this->dbManager = $container->get('db.manager');
     $this->dbManager->queryOnce("DEALLOCATE ALL");
     $this->dropAllTables();
     $this->dropAllSequences();
 }
开发者ID:rlintu,项目名称:fossology,代码行数:24,代码来源:TestPgDb.php

示例10: Output

 /**
  * \brief Generate output.
  */
 function Output()
 {
     global $PG_CONN;
     global $Plugins;
     // make sure there is a db connection since I've pierced the core-db abstraction
     if (!$PG_CONN) {
         DBconnect();
         if (!$PG_CONN) {
             echo "NO DB connection";
         }
     }
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     // tmp  $this->popmd5();
     switch ($this->OutputType) {
         case "XML":
             break;
         case "Text":
             break;
         case "HTML":
             // micro menus
             $V .= menu_to_1html(menu_find($this->Name, $MenuDepth), 0);
             //debugprint($_REQUEST, "_REQUEST");
             $errorstr = "License not added";
             // update the db
             if (@$_POST["updateit"]) {
                 $resultstr = $this->Updatedb($_POST);
                 $V .= $resultstr;
                 if (strstr($resultstr, $errorstr)) {
                     $V .= $this->Updatefm(0);
                 } else {
                     $V .= $this->Inputfm();
                 }
                 break;
             }
             if (@$_REQUEST['add'] == 'y') {
                 $V .= $this->Updatefm(0);
                 break;
             }
             // Add new rec to db
             if (@$_POST["addit"]) {
                 $resultstr = $this->Adddb($_POST);
                 $V .= $resultstr;
                 if (strstr($resultstr, $errorstr)) {
                     $V .= $this->Updatefm(0);
                 } else {
                     $V .= $this->Inputfm();
                 }
                 break;
             }
             // bring up the update form
             $rf_pk = @$_REQUEST['rf_pk'];
             if ($rf_pk) {
                 $V .= $this->Updatefm($rf_pk);
                 break;
             }
             $V .= $this->Inputfm();
             if (@$_POST["req_shortname"]) {
                 $V .= $this->LicenseList($_POST["req_shortname"], $_POST["req_marydone"]);
             }
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print $V;
     return;
 }
开发者ID:pombredanne,项目名称:fossology-test,代码行数:75,代码来源:admin-license-file.php

示例11: DBInsert

function DBInsert($sql)
{
    DBconnect();
    return mysql_query($sql);
}
开发者ID:AdamBurdel,项目名称:Gallery_GB,代码行数:5,代码来源:db.php

示例12: getRights

 public static function getRights()
 {
     try {
         // Effectue une connexion à la DB.
         $pdo = DBconnect();
         // Prépare la requête.
         $stmt = $pdo->prepare("SELECT * FROM t_right ORDER BY id");
         // Execute la requête.
         if ($stmt->execute()) {
             // Set le type de traitement de la réponse.
             $stmt->setFetchMode(PDO::FETCH_CLASS, 'Right');
             // Récupère le résultat de la requête.
             if ($r = $stmt->fetchAll()) {
                 return $r;
             }
         }
         // Retourne un objet null si l'utilisateur n'a pas été récuperé.
         return null;
     } catch (Exception $e) {
         // Retourne un objet null si une erreur c'est produite.
         return null;
     } finally {
         // Ferme le traitement.
         $stmt->closeCursor();
         // Ferme la connexion vers la base de donnée.
         $pdo = null;
     }
 }
开发者ID:xxxkikixxx,项目名称:sti_projet_2,代码行数:28,代码来源:fctright.php

示例13: CheckConfigurationFile

 function CheckConfigurationFile()
 {
     global $DB, $ZBX_SERVER, $ZBX_SERVER_PORT;
     if (!empty($DB)) {
         $old_DB = true;
         $old_DB_TYPE = $DB['TYPE'];
         $old_DB_SERVER = $DB['SERVER'];
         $old_DB_PORT = $DB['PORT'];
         $old_DB_DATABASE = $DB['DATABASE'];
         $old_DB_USER = $DB['USER'];
         $old_DB_PASSWORD = $DB['PASSWORD'];
         $old_ZBX_SERVER = $ZBX_SERVER;
         $old_ZBX_SERVER_PORT = $ZBX_SERVER_PORT;
     }
     $error = null;
     $error_msg = null;
     global $ZBX_CONFIGURATION_FILE;
     if (file_exists($ZBX_CONFIGURATION_FILE)) {
         include $ZBX_CONFIGURATION_FILE;
         if (isset($DB['TYPE']) && isset($DB['SERVER']) && isset($DB['DATABASE']) && isset($DB['USER']) && isset($DB['PASSWORD']) && isset($ZBX_SERVER) && isset($ZBX_SERVER_PORT) && isset($IMAGE_FORMAT_DEFAULT) && $DB['TYPE'] == $this->getConfig('DB_TYPE', null) && $DB['SERVER'] == $this->getConfig('DB_SERVER', null) && $DB['PORT'] == $this->getConfig('DB_PORT', null) && $DB['DATABASE'] == $this->getConfig('DB_DATABASE', null) && $DB['USER'] == $this->getConfig('DB_USER', null) && $DB['PASSWORD'] == $this->getConfig('DB_PASSWORD', null)) {
             if (!DBconnect($error_msg)) {
                 $error_msg = 'Can not connect to database';
             }
         } else {
             $error_msg = 'Incorrect configuration file[' . $ZBX_CONFIGURATION_FILE . ']';
         }
         DBclose();
     } else {
         $error = 'Missing configuration file[' . $ZBX_CONFIGURATION_FILE . ']';
     }
     if (isset($error_msg)) {
         error($error_msg);
     }
     /* restore connection */
     global $DB;
     if (isset($old_DB)) {
         $DB['TYPE'] = $old_DB_TYPE;
         $DB['SERVER'] = $old_DB_SERVER;
         $DB['PORT'] = $old_DB_PORT;
         $DB['DATABASE'] = $old_DB_DATABASE;
         $DB['USER'] = $old_DB_USER;
         $DB['PASSWORD'] = $old_DB_PASSWORD;
         $ZBX_SERVER = $old_ZBX_SERVER;
         $ZBX_SERVER_PORT = $old_ZBX_SERVER_PORT;
     }
     DBconnect($error2);
     return !isset($error) && !isset($error_msg);
 }
开发者ID:rennhak,项目名称:zabbix,代码行数:48,代码来源:setup.inc.php

示例14: RDride

?>
</TH>
 <TH class="tbLogHeader">Location</TH>
 <TH class="tbLogHeader">Dist<br><?php 
echo $units->distanceString();
?>
</TH>
 <TH class="tbLogHeader">Time</TH>
 <TH class="tbLogHeader">Avg<br><?php 
echo $units->velocityString();
?>
</TH>
 <TH class="tbLogHeader">Effort</TH>
</TR>
<?php 
$rides = new RDride(DBconnect(), $units);
$result = $rides->queryRides($currentQuery->getWhereStatement(), $start, $num + 1);
$totalTime = 0;
$totalDist = 0;
$numRides = 0;
//Not really num rides, used to see if more data is available.
while ($rides->parseNextRow($result)) {
    $numRides++;
    if ($numRides > $num) {
        break;
    }
    echo "<TR>";
    echo "<TD class=\"tbLogBody\">" . "<a href=\"showRide.php";
    $tgetvars = $getVars;
    $tgetvars["rideID"] = $rides->f_rideID;
    echo encodeGet($tgetvars) . "\">" . $rides->getDatePart() . " " . $rides->getTimePart() . "</a>&nbsp;" . "<img width='10' height='16' src=\"" . getImgForTemp($rides->f_temperature, $units) . "\">" . "<img width='25' height='16' src=\"s" . $rides->f_sky . ".png\">" . "<img width='16' height='16' src=\"w" . $rides->f_wind . ".png\">" . "</TD>";
开发者ID:BackupTheBerlios,项目名称:ridedammit-svn,代码行数:31,代码来源:showRides.php

示例15: PostInitialize

 /**
  * \brief This is where the magic for
  * Authentication happens.
  */
 function PostInitialize()
 {
     global $PG_CONN;
     global $SysConf;
     if (siteminder_check() == -1) {
         return;
     }
     $UID = siteminder_check();
     global $container;
     /** @var Session $session */
     $session = $container->get('session');
     $session->setName('Login');
     $session->start();
     if (array_key_exists(Auth::USER_ID, $_SESSION)) {
         $SysConf['auth'][Auth::USER_ID] = $_SESSION[Auth::USER_ID];
     }
     $Now = time();
     if (!empty($_SESSION['time'])) {
         /* Logins older than 60 secs/min * 480 min = 8 hr are auto-logout */
         if (@$_SESSION['time'] + 60 * 480 < $Now) {
             $_SESSION['User'] = NULL;
             $_SESSION[Auth::USER_ID] = NULL;
             $_SESSION[Auth::USER_LEVEL] = NULL;
             $SysConf['auth'][Auth::USER_ID] = NULL;
             $_SESSION['UserEmail'] = NULL;
             $_SESSION['Folder'] = NULL;
             $_SESSION['UiPref'] = NULL;
             /* TODO: need to clear SiteMinder session */
         }
     }
     /* check db connection */
     if (!$PG_CONN) {
         DBconnect();
         if (!$PG_CONN) {
             echo "NO DB connection";
         }
     }
     /* Enable or disable plugins based on login status */
     $Level = PLUGIN_DB_NONE;
     if (@$_SESSION['User']) {
         //TODO: also need to check SiteMinder session
         /* If you are logged in, then the default level is "Download". */
         if ("X" . $_SESSION[Auth::USER_LEVEL] == "X") {
             $Level = PLUGIN_DB_WRITE;
         } else {
             $Level = $_SESSION[Auth::USER_LEVEL];
         }
         /* Recheck the user in case he is suddenly blocked or changed. */
         if (empty($_SESSION['time_check'])) {
             $_SESSION['time_check'] = time() + 480 * 60;
         }
         if (time() >= @$_SESSION['time_check']) {
             $sql = "SELECT * FROM users WHERE user_pk='" . @$_SESSION['UserId'] . "';";
             $result = pg_query($PG_CONN, $sql);
             DBCheckResult($result, $sql, __FILE__, __LINE__);
             $R = pg_fetch_assoc($result);
             pg_free_result($result);
             $_SESSION['User'] = $R['user_name'];
             $_SESSION['Folder'] = $R['root_folder_fk'];
             $_SESSION[Auth::USER_LEVEL] = $R['user_perm'];
             $_SESSION['UserEmail'] = $R['user_email'];
             $_SESSION['UserEnote'] = $R['email_notify'];
             if (empty($R['ui_preference'])) {
                 $_SESSION['UiPref'] = 'simple';
             } else {
                 $_SESSION['UiPref'] = $R['ui_preference'];
             }
             $Level = $_SESSION[Auth::USER_LEVEL];
         }
     } else {
         $this->CheckUser($UID);
         $Level = $_SESSION[Auth::USER_LEVEL];
     }
     /* Disable all plugins with >= $Level access */
     plugin_disable($Level);
     $this->State = PLUGIN_STATE_READY;
 }
开发者ID:DanielDobre,项目名称:fossology,代码行数:81,代码来源:core-smauth.php


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