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


PHP DBConnect函数代码示例

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


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

示例1: obtenerArancel

 function obtenerArancel($colegio_ID, $curso, $aran_anio)
 {
     DBConnect($this->dbh, BD_SIGA);
     $SQL = "SELECT * FROM arancel WHERE FK_colegios_colegio_ID = '{$colegio_ID}'\r\n                                            AND FK_curso = '{$curso}'\r\n                                            AND aran_anio = '{$aran_anio}'";
     $result = DBQuery($SQL, $this->dbh);
     $row = DBFetchArray($result);
     DBConnect($dbh);
     //dpr($_SESSION['colegio']->colegio_ID);
     if (!$row['aran_monto']) {
         switch ($_SESSION['colegio']->colegio_ID) {
             case "abello":
                 $row['aran_monto'] = ArancelColegio::ABELLO;
                 break;
             case "edupac":
                 $row['aran_monto'] = ArancelColegio::EDUPAC;
                 break;
             case "dor":
                 if (substr($curso, 0, -1) >= 9) {
                     $row['aran_monto'] = ArancelColegio::DOR_MEDIA;
                 } else {
                     $row['aran_monto'] = ArancelColegio::DOR_BASICA;
                 }
                 break;
         }
         //$_SESSION[''] =
     }
     return $row;
 }
开发者ID:ranmadxs,项目名称:dorcl,代码行数:28,代码来源:class_arancel.php

示例2: __construct

 public function __construct()
 {
     $this->DBHandler = DBConnect();
     $this->instance_table = new Table();
     $this->FG_QUERY_ADITION_SIP = 'name, accountcode, regexten, amaflags, callgroup, callerid, canreinvite, context, DEFAULTip, dtmfmode, fromuser, fromdomain, host, insecure, language, ' . 'mailbox, md5secret, nat, deny, permit, mask, pickupgroup, port, qualify, restrictcid, rtptimeout, rtpholdtimeout, secret, type, username, disallow, allow, musiconhold, regseconds, ' . 'ipaddr, cancallforward, fullcontact, setvar, lastms, regserver, defaultuser, auth, subscribemwi, vmexten, cid_number, callingpres, usereqphone, incominglimit, subscribecontext, ' . 'musicclass, mohsuggest, allowtransfer, autoframing, maxcallbitrate, outboundproxy, rtpkeepalive';
     $this->FG_QUERY_ADITION_IAX = 'name, accountcode, regexten, amaflags, callerid, context, DEFAULTip, host, language, mask, port, qualify, secret, username, disallow, allow, regseconds, ' . 'ipaddr, trunk, dbsecret, regcontext, sourceaddress, mohinterpret, mohsuggest, inkeys, outkey, cid_number, sendani, fullname, auth, maxauthreq, encryption, transfer, jitterbuffer, ' . 'forcejitterbuffer, codecpriority, qualifysmoothing, qualifyfreqok, qualifyfreqnotok, timezone, adsi, setvar, type, deny, permit, requirecalltoken, maxcallnumbers, ' . 'maxcallnumbers_nonvalidated';
 }
开发者ID:pearlvoip,项目名称:a2billing,代码行数:7,代码来源:Class.Realtime.php

示例3: actualizarMensualidades

function actualizarMensualidades($db1, $db2)
{
    //	$db1="dorcl_dor2007";
    //	$db2="dorcl_dor2008";
    echo "actualizando {$db2}";
    DBConnect($dbh, $db1);
    $sql = 'SELECT * FROM `alumnos`';
    $result = mysql_query($sql, $dbh);
    $barrita = ".";
    $cont = 0;
    while ($row = mysql_fetch_array($result)) {
        $detalle2 = "";
        $barrita = $barrita . ".";
        $rut = $row["rut"];
        $apellidop = $row["apellidop"];
        $apellidom = $row["apellidom"];
        $nombres = $row["nombres"];
        $curso = $row["curso"];
        $sql3 = 'SELECT * FROM `mensualidades` where `rut` = ' . "'" . $rut . "';";
        mysql_select_db($db1);
        $result3 = mysql_query($sql3, $dbh);
        $row3 = mysql_fetch_array($result3);
        $mensualidad = $row3["mensualidad"];
        $descuentos = $row3["descuentos"];
        $deuda = $row3["deuda"];
        $detalle = $row3["detalle"];
        $deudaaux = 0;
        $deuda2 = $deuda;
        if ($deuda2 > 0) {
            $detalle2 = $detalle;
        }
        //echo "Mensualidad:$mensualidad, Descuento: $descuentos, Deuda : $deuda, Detalles : $detalle<br>";
        $c[0] = $row3["c0"];
        for ($i = 1; $i <= 10; $i++) {
            $c[$i] = $row3["c" . $i];
            $deudaaux = $deudaaux + ($mensualidad - $mensualidad * ($descuentos / 100) - $c[$i]);
            //echo "c$i:$c[$i]";
        }
        $deuda2 = $deuda2 + $deudaaux;
        if ($deuda2 > 0) {
            $detalle2 = $detalle2 . " Deuda arancel " . $_SESSION[base_datos]->anio;
        }
        mysql_select_db($db2);
        $sql4 = "INSERT INTO `mensualidades` (rut, deuda, detalle) values('" . $deuda2 . "','" . $detalle2 . "');";
        echo "{$sql4}<br>";
        mysql_query($sql4, $dbh);
        //echo"<br><br>";
        /*

        	$letra = $curso{strlen($curso)-1};

        	$curso = $curso = substr ($curso, 0, -1);

        	$curso++;

        	$curso=$curso.$letra;

        	$sql2 = "UPDATE `alumnos` SET `curso` ="."'".$curso."' where `rut` ="."'".$rut."';";

        	mysql_select_db ($db2);
开发者ID:ranmadxs,项目名称:dorcl,代码行数:60,代码来源:actualizar.php

示例4: MCGetHouse

function MCGetHouse($house, $key = 'ts')
{
    global $memcache;
    static $houseKeys = array();
    if ($key == 'ts') {
        if (isset($houseKeys[$house])) {
            return $houseKeys[$house];
        }
        $houseKeys[$house] = $memcache->get('h' . $house . '_ts');
        if ($houseKeys[$house] === false) {
            $houseKeys[$house] = 1;
            MCSetHouse($house, $key, $houseKeys[$house]);
            // so we don't query a billion times on this key
            $altDb = DBConnect(true);
            if ($altDb) {
                $stmt = $altDb->prepare('SELECT max(unix_timestamp(updated)) FROM tblSnapshot WHERE house = ?');
                $stmt->bind_param('i', $house);
                $stmt->execute();
                $stmt->bind_result($houseKeys[$house]);
                $gotHouse = $stmt->fetch() === true;
                $stmt->close();
                if ($gotHouse) {
                    MCSetHouse($house, $key, $houseKeys[$house]);
                } else {
                    $houseKeys[$house] = 1;
                }
                $altDb->close();
            }
        }
        return $houseKeys[$house];
    }
    return MCGet('h' . $house . '_' . MCGetHouse($house) . '_' . $key);
}
开发者ID:erorus,项目名称:newsstand,代码行数:33,代码来源:memcache.incl.php

示例5: getRecords

 /**
  * Взять информацию по найденным результатам
  *
  * @return array массив с пользователями
  */
 function getRecords($order_by = NULL)
 {
     if ($this->matches) {
         $sql = "SELECT * FROM search_users_simple WHERE id IN (" . implode(', ', $this->matches) . ')';
         if ($order_by) {
             $sql .= " ORDER BY {$order_by}";
         } else {
             if ($this->_sortby && (($desc = $this->_sort == SPH_SORT_ATTR_DESC) || $this->_sort == SPH_SORT_ATTR_ASC)) {
                 $sql .= " ORDER BY {$this->_sortby}" . ($desc ? ' DESC' : '');
             }
         }
         if ($res = pg_query(DBConnect(), $sql)) {
             if (!$order_by && ($this->_sort == SPH_SORT_RELEVANCE || $this->_sort == SPH_SORT_EXTENDED)) {
                 $links = array();
                 $rows = array();
                 while ($row = pg_fetch_assoc($res)) {
                     $links[$row['id']] = $row;
                 }
                 for ($i = 0; $i < count($this->matches); $i++) {
                     $rows[] = $links[$this->matches[$i]];
                 }
             } else {
                 $rows = pg_fetch_all($res);
             }
             return $rows;
         }
     }
     return array();
 }
开发者ID:notUserDeveloper,项目名称:fl-ru-damp,代码行数:34,代码来源:search_element_users_simple.php

示例6: __construct

 function __construct()
 {
     if (intval(EXPIRES) > 0) {
         $expiryTime = intval(EXPIRES);
     }
     $this->db = DBConnect();
     $this->tbUser = $this->db->tbPrefix . 'user';
     $this->tbField = $this->db->tbPrefix . 'field';
     $this->tbUserField = $this->db->tbPrefix . 'user_field';
     $this->tbSession = $this->db->tbPrefix . 'session';
     $this->ocKey = Val('ocKey', 'COOKIE');
     if (!empty($this->ocKey)) {
         $row = $this->db->FirstRow("SELECT userId,token,data FROM " . $this->tbSession . " WHERE ocKey='" . $this->ocKey . "' AND expires>" . time());
         $this->userId = intval($row['userId']);
         $this->token = $row['token'];
         $data = $row['data'];
         if (!empty($data)) {
             $data = unserialize($data);
             $this->adminLevel = intval($data['adminLevel']);
             $this->userName = $data['userName'];
             $avatarDir = URL_ROOT . '/upload/avatar/';
             $this->avatarImg = empty($data['avatarImg']) ? $avatarDir . 'avatar_50_50.gif' : $avatarDir . $data['avatarImg'];
             $this->avatarImg_s = empty($data['avatarImg_s']) ? $avatarDir . 'avatar_30_30.gif' : $avatarDir . $data['avatarImg_s'];
             $this->signature = $data['signature'];
             $this->db->Execute("UPDATE " . $this->tbSession . " SET updateTime='" . time() . "',expires=expires+" . $this->expiryTime . " WHERE ocKey='" . $this->ocKey . "'");
         }
     }
 }
开发者ID:Root-Whoami,项目名称:xss,代码行数:28,代码来源:User.class.php

示例7: Init

function Init()
{
    session_start();
    // chama config
    $configFile = $_SERVER['DOCUMENT_ROOT'] . '/painel/system/config.php';
    if (!file_exists($configFile)) {
        die('Erro arquivo config.php não existe!');
    } else {
        require_once $configFile;
    }
    //chama helpers
    if (!file_exists(FILE_HELP)) {
        die('Erro arquivo helpers.php não existe!');
    } else {
        require_once FILE_HELP;
    }
    //chama database
    if (!file_exists(FILE_DATABASE)) {
        die('Erro arquivo database.php não existe!');
    } else {
        require_once FILE_DATABASE;
    }
    DBConnect();
    DoLogout();
}
开发者ID:juniorthiesen,项目名称:dash,代码行数:25,代码来源:system.php

示例8: DBExecute

function DBExecute($query)
{
    $link = DBConnect();
    $result = mysqli_query($link, $query) or die(mysqli_error($link));
    DBClose($link);
    return $result;
}
开发者ID:hsnunes,项目名称:drmeatende,代码行数:7,代码来源:database.php

示例9: DBCambioPermanente

 public function DBCambioPermanente($anio)
 {
     DBConnect($dbh);
     mysql_select_db(BD_SIGA);
     $SQL = "UPDATE db SET anio = '{$anio}'\r\n                            WHERE db_ID ='" . $_SESSION['base_datos']->db_ID . "'";
     $this->DBQuery($SQL, $dbh);
     mysql_select_db($_SESSION['base_datos']->nombrebd);
 }
开发者ID:ranmadxs,项目名称:dorcl,代码行数:8,代码来源:MySQL_DB.php

示例10: SiteDB

function SiteDB()
{
    global $CONFIG_DATABASE_SERVER;
    global $CONFIG_DATABASE_DATABSE;
    global $CONFIG_DATABASE_USER;
    global $CONFIG_DATABASE_PASS;
    return DBConnect($CONFIG_DATABASE_SERVER, $CONFIG_DATABASE_DATABSE, $CONFIG_DATABASE_USER, $CONFIG_DATABASE_PASS);
}
开发者ID:JeffM2501,项目名称:HackSharp,代码行数:8,代码来源:index.php

示例11: DBExec

function DBExec($sql)
{
    DBConnect();
    $res = mysql_query($sql);
    if (false === $res) {
        return false;
    }
    return true;
}
开发者ID:AnnaOzer,项目名称:shp-php2,代码行数:9,代码来源:db.php

示例12: DBQueryOne

function DBQueryOne($sql)
{
    DBConnect();
    $res = mysql_query($sql);
    if (!$res) {
        return [];
    }
    $row = mysql_fetch_assoc($res);
    return $row;
}
开发者ID:AnnaOzer,项目名称:php1_2015,代码行数:10,代码来源:db.php

示例13: DBQuery

function DBQuery($sql)
{
    DBConnect();
    $res = mysqli_query($sql);
    $ret = [];
    while ($row = mysqli_fetch_assoc($res)) {
        $ret = $row;
    }
    return $ret;
}
开发者ID:Tair111,项目名称:php-pr,代码行数:10,代码来源:db.php

示例14: DataIntervalsData

function DataIntervalsData()
{
    $cacheKey = 'dataintervalstable';
    if (($tr = MCGet($cacheKey)) !== false) {
        return $tr;
    }
    $db = DBConnect();
    $sql = <<<'EOF'
select t.house, t.lastupdate,
	t.mindelta, modes.delta as modedelta, t.avgdelta, t.maxdelta,
	r.region, group_concat(r.name order by 1 separator ', ') nms
from (
	select deltas.house, max(deltas.updated) lastupdate, round(min(delta)/5)*5 mindelta, round(avg(delta)/5)*5 avgdelta, round(max(delta)/5)*5 maxdelta
	from (
		select sn.updated,
			if(@prevhouse = sn.house and sn.updated > timestampadd(hour, -48, now()), unix_timestamp(sn.updated) - @prevdate, null) delta,
			@prevdate := unix_timestamp(sn.updated) updated_ts,
			@prevhouse := sn.house house
		from (select @prevhouse := null, @prevdate := null) setup, tblSnapshot sn
		order by sn.house, sn.updated) deltas
	group by deltas.house) t
left join (
	select house, delta
	from (
		select if(@prev = house, @rownum := @rownum + 1, @rownum := 0) o, delta, (@prev := house) as house, c
		from (
			select house, delta, count(*) c
			from (
				select sn.updated,
					round(if(@prevh = sn.house, unix_timestamp(sn.updated) - @prevd, null)/5)*5 delta,
					@prevd := unix_timestamp(sn.updated) updated_ts,
					@prevh := sn.house house
				from (select @prevh := null, @prevd := null) setup, tblSnapshot sn
				where sn.updated > timestampadd(hour, -48, now())
				order by sn.house, sn.updated) deltas
			where delta is not null
			group by house, delta
			order by house, c desc
		) tosort,
		(select @rownum := 0, @prev := null) setup) filtered
		where o=0
	) modes on modes.house = t.house
join tblRealm r on r.house = t.house and r.locale is not null
group by r.house
order by 4 asc, 3 asc, region asc, nms asc
EOF;
    $stmt = $db->prepare($sql);
    $stmt->execute();
    $result = $stmt->get_result();
    $tr = DBMapArray($result, null);
    $stmt->close();
    MCSet($cacheKey, $tr, 60);
    return $tr;
}
开发者ID:erorus,项目名称:newsstand,代码行数:54,代码来源:dataintervals.php

示例15: currencies

 public function currencies()
 {
     $this->currencies = array();
     $currenciesTable = new Table("cc_currencies", " * ");
     $DBHandle = DBConnect();
     $return = $currenciesTable->Get_list($DBHandle, "", 0);
     $this->currencies = array();
     foreach ($return as $value) {
         $this->currencies[$value['currency']] = array('currency' => $value['currency'], 'name' => $value['name'], 'value' => $value['value'], 'decimal_point' => $value['decimal_point'], 'basecurrency' => $value['basecurrency'], 'decimal_places' => 2);
     }
 }
开发者ID:saydulk,项目名称:a2billing,代码行数:11,代码来源:currencies.php


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