本文整理汇总了PHP中DatabaseConnection::createConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::createConnection方法的具体用法?PHP DatabaseConnection::createConnection怎么用?PHP DatabaseConnection::createConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::createConnection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
<?php
define("PAGENAME", "Home");
session_start();
include '../common/Config.php';
include '../common/DatabaseConnection.php';
if (!isset($_SESSION['artefactUser'])) {
header("Location: ../../index.php");
}
$user = $_SESSION['artefactUser'];
$obj = new DatabaseConnection();
$conn = $obj->createConnection();
$fullName = "";
$location = "";
$locationFK = "";
$userPK = '';
$userRole = '';
$user1 = $obj->setQuery("select u.FirstName,u.LastName,u.UserPk,u.RoleFk,u.LocationFK,l.Description from user u inner join archivelocation l on u.LocationFk = l.LocationPk where u.AbhyasiID = '{$user}'");
if ($user1->num_rows == 1) {
while ($row = $user1->fetch_assoc()) {
$fullName = $row['FirstName'] . " " . $row['LastName'];
$location = $row['Description'];
$locationFK = $row['LocationFK'];
$userPK = $row['UserPk'];
$userRole = $row['RoleFk'];
}
$_SESSION['userLoc'] = $locationFK;
$_SESSION['userPK'] = $userPK;
$_SESSION['userRole'] = $userRole;
$_SESSION['userLocationDesc'] = $location;
$_SESSION['fullName'] = $fullName;
示例2: DatabaseConnection
<?php
ini_set('max_execution_time', 30000);
include_once 'DatabaseConnection.php';
$type = $_GET['type'];
session_start();
$_SESSION['type'] = $type;
$db = new DatabaseConnection();
$conn = $db->createConnection();
$parentArray = array();
//Associate Array with ArtefactCode and ArtefactPID
//$single = array('Photos');
$NoChild = array();
//Query to Get Parent elements
$parentQuery = "select artefactname,artefactcode from artefact\n\t\t\t\twhere artefactPID is null and artefactTypeCode='{$type}' and visiblestatus='on' order by CreatedDate DESC";
//echo $parentQuery;
$result = $db->setQuery($parentQuery);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$parentArray[$row['artefactcode']] = $row['artefactname'];
//echo '>>'.$row['artefactcode'].'>>'.$row['artefactname'].'</br>';
}
} else {
echo "Sorry No Data for this Artefact...";
}
$childrenArray = array();
//Associate Array with ParentArtefactCode and array(Child: ArtefactCode and ArtefactName)
//Query to Get Children
$childChild = array();
//to store parent->child[This Name... Code is in associate array]->child
foreach ($parentArray as $parentCode => $parentValue) {
示例3: DatabaseConnection
<?php
include_once '../common/DatabaseConnection.php';
include 'mail.php';
require 'PHPMailerAutoload.php';
$db1 = new DatabaseConnection();
$db1->createConnection();
$res = wwwcopy("todayTask.php");
$sqlC = "select\n\t\t\t\ts.ScheduleMaintenancePK,\n\t\t\t\ts.ArtefactCode,\n\t\t\t\ta.ArtefactName,\n\t\t\t\ts.ScheduledServiceDate\n\t\t\t\tfrom scheduledmaintenance s\n\t\t\t\tinner join artefact a\n\t\t\t\ton s.ArtefactCode = a.ArtefactCode\n\t\t\t\twhere s.ScheduleMaintenancePK\n\t\t\t\tnot in (select ScheduleMaintenanceFK from tasklist)\n\t\t\t\tand s.ScheduledServiceDate <= current_date()\n\t\t\t\tand a.visiblestatus='on'";
$resu1 = $db1->setQuery($sqlC);
if ($resu1->num_rows > 0) {
$sql1 = "select FirstName,LastName,EmailId\n\t\t\t\t\tfrom user";
$resu1 = $db1->setQuery($sql1);
if ($resu1->num_rows > 0) {
while ($r = $resu1->fetch_assoc()) {
$name = $r['FirstName'] . " " . $r['LastName'];
$email = $r['EmailId'];
$res1 = str_replace("{{user}}", $name, $res);
echo sendMail($email, $res1);
}
}
}