本文整理汇总了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;
}
示例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';
}
示例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);
示例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);
}
示例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();
}
示例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 . "'");
}
}
}
示例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();
}
示例8: DBExecute
function DBExecute($query)
{
$link = DBConnect();
$result = mysqli_query($link, $query) or die(mysqli_error($link));
DBClose($link);
return $result;
}
示例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);
}
示例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);
}
示例11: DBExec
function DBExec($sql)
{
DBConnect();
$res = mysql_query($sql);
if (false === $res) {
return false;
}
return true;
}
示例12: DBQueryOne
function DBQueryOne($sql)
{
DBConnect();
$res = mysql_query($sql);
if (!$res) {
return [];
}
$row = mysql_fetch_assoc($res);
return $row;
}
示例13: DBQuery
function DBQuery($sql)
{
DBConnect();
$res = mysqli_query($sql);
$ret = [];
while ($row = mysqli_fetch_assoc($res)) {
$ret = $row;
}
return $ret;
}
示例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;
}
示例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);
}
}