本文整理汇总了PHP中Connection::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getConnection方法的具体用法?PHP Connection::getConnection怎么用?PHP Connection::getConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection::getConnection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ejectInvoice
public function ejectInvoice()
{
$con = new Connection();
$link = $con->getConnection();
$stmt = $link->prepare($this->query);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_BOTH);
//execute the second query
$stmt1 = $link->prepare($this->query_row);
$stmt1->execute();
$row1 = $stmt1->fetch(PDO::FETCH_BOTH);
//convert the material to an array and iterate
$codes = explode("*", $row1["stock_code"]);
$desc = explode("*", $row1["item_description"]);
$qty = explode("*", $row1["qty"]);
$rate = explode("*", $row1["unit_price"]);
$value = explode("*", $row1["value"]);
//print_r($materials);
for ($i = 0; $i < sizeof($codes) - 1; $i++) {
$this->invoiceRows .= ' <tr class="item-row" id="itemID"><td>' . ($i + 1) . '</td>
<td class="item-name"><div class="delete-wpr"><textarea data-role="none" class="item_name">' . $codes[$i] . '</textarea></div></td>
<td class="description"><textarea disabled data-role="none" class="item_description">' . html_entity_decode($desc[$i]) . '</textarea></td>
<td><span disabled class="cost" data-role="none" id="re-unitCost"><del>N</del>' . $rate[$i] . '</span></td>
<td><textarea disabled class="qty" data-role="none" id="re-quantity">' . $qty[$i] . '</textarea></td>
<td><span class="price" ><del>N</del>' . $value[$i] . '</span></td>
</tr>';
}
return array("invoiceDate" => $row["invoiceDate"], "jobid" => $row["jobNumber"], "invoiceNumber" => $row["invoiceNumber"], "subtotal" => $row["subTotal"], "total" => $row["total"], "invoiceRows" => $this->invoiceRows, "amountPaid" => $row["amountPaid"], "balanceDue" => $row["balanceDue"], "vat" => $row["vat"], "labourCost" => $row["labourcost"], "customer" => $row["customerTitle"]);
}
示例2: getConnection
/**
*
* @return \Doctrine\DBAL\Connection
*/
function getConnection()
{
if (!$this->connection) {
$this->connection = Connection::getConnection();
}
return $this->connection;
}
示例3: __call
public function __call($name, $arguments)
{
$method = $this->controller->getMethod($name);
if ($method) {
$connection = Connection::getConnection();
return $connection->call($name, $arguments);
}
}
示例4: addCliente
public static function addCliente($cliente)
{
$connection = Connection::getConnection();
$sql = "INSERT INTO clientes (cpf, nome, cidades_id) VALUES ({$cliente->cpf}, '{$cliente->nome}', {$cliente->cidades_id})";
$result = mysqli_query($connection, $sql);
$novoCliente = ClienteDAO::getClienteByCPF($cliente->cpf);
return $novoCliente;
}
示例5: prpare
public function prpare()
{
$con = new Connection();
$link = $con->getConnection();
$stmt = $link->prepare($this->query);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_BOTH);
return array("dategenerated" => $row['date'], "location" => html_entity_decode($row["location"]), "reportcode" => $row["reportcode"], "maintype" => $row["maintype"]);
}
示例6: contarTokensCanjeados
public function contarTokensCanjeados($user_id)
{
$connection = Connection::getConnection();
$user_id = (int) $user_id;
$sql_query = "SELECT count(*) AS total FROM token WHERE user_id={$user_id}";
$result = $connection->query($sql_query);
$data = $result->fetch_assoc();
$c = (int) $data['total'];
return $c;
}
示例7: validate_persona_id
public function validate_persona_id($persona_id)
{
Connection::getConnection()->connect();
$resp = ContrPack1::getInstance()->getPersona($persona_id);
if ($resp[0] != null) {
Connection::getConnection()->close();
return true;
}
Connection::getConnection()->close();
return "({$persona_id}) no es una persona válida";
}
示例8: addToDatabase
function addToDatabase($rname, $rsize, $rtype, $rname_usr, $rtype_usr, $rdesc, $extension, $rprio)
{
$auth = new Authenticate();
$con = new Connection();
$link = $con->getConnection();
$query = "INSERT INTO `resources`(`ID`, `name`,`rNameUsr`,`rsize`, `rtype`, `format`, `doc_by`,`user_r_type`,`rDescription`,`rprio`, `when`, `approved`) VALUES (NULL,?,?,?,?,?,?,?,?,?,?,?)";
//$query = "INSERT INTO `categories`(`cat_id`,`cat_name`,`cat_description`,`cat_by`) VALUES (NULL,?,?,?)";
$stmt = $link->prepare($query);
$stmt->execute(array($rname, $rname_usr, $rsize, $rtype, $extension, $auth->getFullName($_SESSION['user_id']), $rtype_usr, $rdesc, $rprio, date("Y-m-d H:i:m", time()), 0));
$stmt = null;
return TRUE;
}
示例9: __construct
public function __construct()
{
$this->istok = DBHelper::getIstok(Connection::getConnection());
$this->obj = Creator::getObject($this->istok["name"]);
$this->columneNames = $this->istok["colnames"];
$this->data = $this->istok["colvalues"];
//print_r($this->istok);
//$this->test();
//print_r($this->obj); echo PHP_EOL;
//print_r($this->columneNames);echo PHP_EOL;
//print_r($this->data);echo PHP_EOL;
}
示例10: verify
public function verify()
{
$query = "UPDATE `users` SET `verified`= 1 WHERE `ID` = '{$this->id}'";
$con = new Connection();
$link = $con->getConnection();
$stmt = $link->prepare($query);
if ($stmt->execute()) {
return true;
} else {
return false;
}
}
示例11: listarSorteos
public static function listarSorteos()
{
$sorteos = array();
$connection = Connection::getConnection();
$sql_query = "SELECT id, fecha, ganador, nombre FROM sorteo;";
$result = $connection->query($sql_query);
if ($result->num_rows > 0) {
while ($row = $result->fetch_object()) {
$sorteos[] = $row;
}
}
return $sorteos;
}
示例12: configureEValuation
public function configureEValuation($user_id, $qCnt, $qCat, $qStl, $qTim)
{
$this->userid = $user_id;
$this->qCount = $qCnt;
$this->qCategory = $qCat;
$this->qStyle = $qStl;
$this->qTime = $qTim;
//connnect to database and store all the values
$con = new Connection();
$link = $con->getConnection();
$query = "INSERT INTO `evaluation`(`ID`, `user_id`, `qCount`, `qCategory`, `qStyle`, `qTime`) " . "VALUES (NULL,?,?,?,?,?)";
$stmt = $link->prepare($query);
$stmt->execute(array($this->userid, $this->qCount, $this->qCategory, $this->qStyle, $this->qTime));
}
示例13: getUserStatus
private function getUserStatus($id)
{
$sql = "SELECT `user_status` FROM `users` WHERE `ID` =?";
$con = new Connection();
$link = $con->getConnection();
$stmt = $link->prepare($sql);
$stmt->execute(array($id));
$result = $stmt->fetch(PDO::FETCH_BOTH);
if ($result["user_status"] == 1) {
return "Active";
} else {
return "Disabled";
}
}
示例14: update
public function update($id, $matricule, $nom, $prenoms, $telephone, $cellulaire, $ville, $quatier, $responsable, $statut)
{
$db = parent::getConnection();
$sql = 'UPDATE agent
SET matricule = :matricule,nom = :nom,prenoms = :prenoms,telephone = :telephone,cellulaire = :cellulaire,ville = :ville,quatier = :quatier,responsable = :responsable,statut = :statut
WHERE id = :id';
$query = $db->prepare($sql);
$query->execute(array('matricule' => $matricule, 'nom' => $nom, 'prenoms' => $prenoms, 'telephone' => $telephone, 'cellulaire' => $cellulaire, 'ville' => $ville, 'quatier' => $quatier, 'responsable' => $responsable, 'statut' => $statut, 'id' => $id));
if ($query) {
echo "ok";
} else {
echo "ko";
}
}
示例15: getByName
public static function getByName($name)
{
$db = Connection::getConnection();
$obj = new User();
$stmt = $db->prepare("SELECT * FROM {$obj->tableName} WHERE userName = :name");
$stmt->bindParam('name', $name);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$row) {
return null;
}
$obj->fromArray($row);
return $obj;
}