本文整理汇总了PHP中Connection::Connect方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::Connect方法的具体用法?PHP Connection::Connect怎么用?PHP Connection::Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection::Connect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load(Connection $connection)
{
if (!$connection->isConnected) {
$connection->Connect();
}
if (!$connection->query($this->medicationQuery)) {
return false;
} else {
$result = null;
$medication = null;
while ($result = $connection->getObject()) {
$medication = new Medication();
$medication->setCommonDose($result->commonDose);
$medication->setGenericName($result->genericName);
$medication->setRoute($result->route);
$medication->setUnit($result->unit);
$medication->setMedicationID($result->medicationId);
$medication->setActive($result->active);
$medication->setConfirmed($result->confirmed);
$medication->setConfirmedBy($result->confirmedBy);
array_push($this->medicationList, $medication);
}
}
return true;
}
示例2: create
public function create( Connection $connection ) {
$query = "select patientId, firstName, lastName, roomNumber, unitName from Patient where unitName = '{$this->unitName}';";
if( !$connection->Connect() ){
echo "error: " . $connection->getError();
return false;
}
if( !$connection->query( $query ) ){
echo "error: " . $connection->getError();
return false;
}
$this->patientList = array();
while( $result = $connection->getObject() ) {
$patient = new Patient( $result->firstName, $result->lastName );
$patient->setPatientID( $result->patientId );
$patient->setRoomNumber( $result->roomNumber );
$patient->setUnitName( $result->unitName );
array_push( $this->patientList, $patient );
}
}
示例3: Connection
<?php
//Importación de las clases de acceso a datos
include_once 'config/config.inc.php';
include_once 'modules/data/connection.class.php';
include_once 'modules/data/query.class.php';
//Instanciación de clases
$Data = new Connection();
$Link = $Data->Connect(SERVER, USER, PASSWORD);
$Link = $Data->SelectDataBase(DB, $Link);
$Querys = new Querys();
$IdUser = $_SESSION['id'];
if (isset($_GET['id'])) {
$Asignatura = $Querys->Select('*', 'asignaturas', "WHERE id_asig='" . $_GET['id'] . "'");
}
$Areas = $Querys->Select('*', 'areas', "");
示例4: count
$numoc = $_SESSION['oc'];
//FOLIO MAYOR
if ($idobra == 0) {
$rowstock = $stock->Select($arr[$i][0]);
if (mysql_fetch_array($rowstock) == null) {
// echo "insert";
$stock->Add($arr[$i][0], 0, '0', $_POST["{$n}"], 0);
} else {
// echo "update";
$stock->UpdateC($arr[$i][0], $_POST["{$n}"]);
}
}
$cont->Add($arr[$i][0], $_SESSION['oc'], $iddoc, $rut, $idobra, $folio, $arr[$i][2], $arr[$i][3], $_POST["{$n}"], 0, $fechaactual);
$sql = "update CONTIENE set CANTIDADBODEGA_CONTIENE=" . $bod . " where ID_MATERIAL=" . $arr[$i][0] . " and NUMERO_OC=" . "'{$numoc}'" . " and ID_DOCUMENTO='0' AND RUT_PROVEEDOR=" . "'{$rut}'" . " AND ID_OBRA=0" . " AND FOLIO_CONTIENE=0";
//echo $sql;
$con->Connect();
$accion = mysql_query($sql);
$con->DisConnect();
}
//}
$au = $_SESSION["autentificado"];
$name = $_SESSION["nombre_usuario"];
$ap = $_SESSION["apellidos_usuario"];
$num = $_SESSION["numoc"];
$tipo = $_SESSION["tipo"];
session_unset();
$_SESSION["autentificado"] = $au;
$_SESSION["nombre_usuario"] = $name;
$_SESSION["apellidos_usuario"] = $ap;
$_SESSION["tipo"] = $tipo;
$_SESSION["size"] = count($arr);
示例5: Connection
<?php
require_once '../classes/config.php';
$connection = new Connection();
$pdo = $connection->Connect();
$registry->set('pdo', $pdo);
startSession();
if (isset($_GET['login'])) {
if (isset($_POST['username']) && isset($_POST['password'])) {
$username = trim($_POST['username']);
$password = trim($_POST['password']);
$stmt = $pdo->prepare("SELECT * FROM users where username = ? AND password = ? LIMIT 1;");
$stmt->execute([$username, $password]);
$row_cnt = $stmt->rowCount();
if ($row_cnt == 1) {
if (startSession()) {
$_SESSION['login_user'] = $username;
$row = $stmt->fetch(PDO::FETCH_LAZY);
$_SESSION['role'] = $row['role'];
}
}
}
}
if (isset($_POST['logout'])) {
destroySession();
exit(header('Location: index.php'));
}
if (isset($_POST['cancel'])) {
exit(header('Location: index.php'));
}
if (!isset($_SESSION['login_user'])) {