本文整理汇总了PHP中DatabaseConnection::setQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::setQuery方法的具体用法?PHP DatabaseConnection::setQuery怎么用?PHP DatabaseConnection::setQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::setQuery方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DatabaseConnection
session_start();
$_SESSION['type'] = $_GET['type'];
$db = new DatabaseConnection();
$db->createConnection();
$dropdownArray = array();
$AttributeComaparison = array();
$dropdownResultArray = array();
$inputType = array();
$columnArray = array();
$aListCode = array();
$checkbox = true;
$search = true;
$isSearchable = "";
//Query to List all the Attributes of the Selected Category. Selected Category is in Session
$dropdownArrayListCodeQuery = "Select distinct AttributeCode,DataType,Attributes\n\t\t\t\t\t\t\tfrom Attributes, ArtefactType\n\t\t\t\t\t\t\twhere Attributes.ArtefactTypeCode = ArtefactType.ArtefactTypeCode \n\t\t\t\t\t\t\tand\n\t\t\t\t\t\t\t{$isSearchable}\n\t\t\t\t\t\t\tArtefactType.ArtefactTypeCode = '{$_SESSION['type']}';";
$dropdownArrayListCode = $db->setQuery($dropdownArrayListCodeQuery);
if ($dropdownArrayListCode->num_rows > 0) {
while ($row = $dropdownArrayListCode->fetch_assoc()) {
$dropdownArray[] = $row['AttributeCode'];
$columnArray[] = $row['Attributes'];
if ($row['DataType'] == 'varchar') {
$inputType[] = 'text';
} else {
if ($row['DataType'] == 'Int') {
$inputType[] = 'text';
//$numberPattern[$numberCount++]="pattern='^[0-9]{1,20}'";
} else {
if ($row['DataType'] == 'date') {
$inputType[] = 'date';
} else {
$inputType[] = 'text';
示例2: date
$endDate = $_GET['endDate'];
$type = $_GET['type'];
$code = $_GET['code'];
session_start();
include '../common/DatabaseConnection.php';
$currentdateq = date('Y-m-d', strtotime($currentdate));
$endDateq = date('Y-m-d', strtotime($endDate));
$location = $_SESSION['userLoc'];
$userPK = $_SESSION['userPK'];
$db = new DatabaseConnection();
$conn = $db->createConnection();
/*
* Query if data already exista in maintainance cycle
* if exists update
* else
* insert
* */
$q;
$message = '';
$res1;
$q = "INSERT INTO maintenancecycle\r\n\t\t \t\t\tVALUES\r\n\t\t \t\t\t(NULL,\r\n\t\t\t \t\t\t'{$location}',\r\n\t\t\t \t\t\t'{$type}',\r\n\t\t\t \t\t\t'{$code}',\r\n\t\t\t \t\t\t'{$currentdateq}',\r\n\t\t\t \t\t\t'0',\r\n\t\t\t \t\t\t'NULL',\r\n\t\t\t \t\t\t'{$endDateq}',\r\n\t\t\t \t\t\t'{$endDateq}',\r\n\t\t\t \t\t\t'{$userPK}',\r\n\t\t\t \t\t\t'{$currentdateq}',\r\n\t\t\t \t\t\t'{$userPK}',\r\n\t\t\t \t\t\t'{$currentdateq}'\r\n\t\t \t\t\t)";
$maintainResult = $db->setQuery($q);
$latRecordId = $conn->insert_id;
$sql = "INSERT INTO scheduledmaintenance\r\n\t\t \t\t\t\t(ScheduleMaintenancePK,\r\n\t\t\t \t\t\t\tMaintenanceCycleFK,\r\n\t\t\t \t\t\t\tArtefactTypeCode,\r\n\t\t\t \t\t\t\tArtefactCode,\r\n\t\t\t \t\t\t\tLocationFK,\r\n\t\t\t \t\t\t\tScheduledServiceDate,\r\n\t\t\t \t\t\t\tCurrentStatus,\r\n\t\t\t \t\t\t\tCreatedDate,\r\n\t\t\t \t\t\t\tCreatedBy,\r\n\t\t\t \t\t\t\tModifiedDate,\r\n\t\t\t \t\t\t\tModifiedBy\r\n\t\t \t\t\t\t) VALUES\r\n\t\t \t\t\t\t(\tNULL,\r\n\t\t\t \t\t\t\t'{$latRecordId}',\r\n\t\t\t \t\t\t\t'{$type}',\r\n\t\t\t \t\t\t\t'{$code}',\r\n\t\t\t \t\t\t\t'{$location}',\r\n\t\t\t \t\t\t\t'{$endDateq}',\r\n\t\t\t \t\t\t\t'Pending',\r\n\t\t\t \t\t\t\tCURRENT_TIMESTAMP,\r\n\t\t\t \t\t\t\t'{$userPK}',\r\n\t\t\t \t\t\t\t'{$currentdate}',\r\n\t\t\t \t\t\t\t'{$userPK}'\r\n\t\t \t\t\t\t)";
$res1 = $db->setQuery($sql);
if ($maintainResult) {
$message .= "Succesfully Updated";
} else {
$message .= $q;
}
echo $message;
示例3: DatabaseConnection
<?php
session_start();
include '../common/DatabaseConnection.php';
$db = new DatabaseConnection();
$db->createConnection();
$id = $_GET['id'];
$sql = "select * from user where rolefk = '{$id}'";
$result = $db->setQuery($sql);
if ($result->num_rows > 0) {
echo "Failed to Delete";
} else {
$sql2 = "delete from role_page_mapping where RoleFk='{$id}'";
$sql1 = "DELETE FROM role WHERE RolePk='{$id}'";
if ($db->setQuery($sql2)) {
if ($db->setQuery($sql1)) {
echo 'success';
}
}
}
示例4: sizeof
<?php
include_once '../common/DatabaseConnection.php';
session_start();
$itemName = $_GET['ItemName'];
$level = $_GET['level'];
$parentNode = $_GET['parentNode'];
$columnLength = sizeof($_SESSION['ColumnArray']);
//create Connection
$db = new DatabaseConnection();
$conn = $db->createConnection();
//Get the max artefactPK
$artefactPK = 0;
$artefactPKfromNameQuery = 'Select artefactCode,(artefactPK*1) as artefactPK from artefact;';
$result = $db->setQuery($artefactPKfromNameQuery);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$artefactPK = $row['artefactPK'];
}
}
//$artefactPK++;
//Getting ArtefactCode of the parent
$artefactCode = 0;
$artefactCodefromNameQuery = 'Select artefactCode from artefact where artefactName=\'' . $parentNode . '\';';
$result = $db->setQuery($artefactCodefromNameQuery);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$artefactCode = $row['artefactCode'];
}
}
$artefactPK = $db->getMax();
示例5: header
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;
}
//echo $locationFK;
示例6: DatabaseConnection
<?php
include "../common/DatabaseConnection.php";
$db = new DatabaseConnection();
$db->createConnection();
$user = $_GET['userpk'];
$sql = "update user set ActiveStatus='off' where userpk='{$user}'";
if ($db->setQuery($sql)) {
echo "success";
} else {
echo "fail";
}
示例7: array
$type = $_GET['type'];
//Query to Check wheather to update a old record or new Record by checking the datas
$attributeValuePK = array();
$user = $_SESSION['userPK'];
//argument
/**
* http://localhost:81/final/SaveAttributes.php?
*
* dataArray=North%20American%20gathering,NULL,10,1986,Italian,120,NULL,People%20may%20say,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL&
* artefactCode=8783&
* artefactName=NVHN-1986-007-1-1&
* type=VHS
*
* */
$artefactDatasQuery = "Select * from attributevalue where artefactCode='{$artefactCode}' and artefactTypeCode='{$type}';";
$resultData = $db->setQuery($artefactDatasQuery);
//echo $artefactDatasQuery;
//$resultData->num_rows==0. if there is no data so insert else update
if ($resultData->num_rows > 0) {
//Query to fetch a attributeValuePK to update data
$attributeValuePKQuery = "Select attributeValuePK,AttributeCode from attributevalue where artefactCode='{$artefactCode}';";
//echo $attributeValuePKQuery;
$attributeCode = array();
$resultSelect = $db->setQuery($attributeValuePKQuery);
if ($resultSelect->num_rows > 0) {
while ($rowData = $resultSelect->fetch_assoc()) {
$attributeValuePK[] = $rowData['attributeValuePK'];
$attributeCode[] = $rowData['AttributeCode'];
}
}
//Query to update data
示例8: DatabaseConnection
include_once '../common/DatabaseConnection.php';
session_start();
$artefactName = $_GET['artefactName'];
$level = $_GET['level'];
$db = new DatabaseConnection();
$conn = $db->createConnection();
//Query to get Max of artefactPK...
$artefactPK = 0;
$artefactCode = 0;
$maxartefactQuery = "Select max(artefactPK) as MaxPK,max(artefactCode*1) as MaxCode from artefact;";
$result = $db->setQuery($maxartefactQuery);
if ($result->num_rows > 0) {
while ($rows = $result->fetch_assoc()) {
$artefactPK = $rows['MaxPK'];
$artefactCode = $rows['MaxCode'];
}
}
$artefactCode++;
$artefactPK++;
$artefactNameAddQuery = "insert into artefact (artefactPK,artefactCode,artefactName,artefactTypeCode,LevelNumber,CreatedDate,CreatedBy) values ({$artefactPK},{$artefactCode},'{$artefactName}','{$_SESSION['type']}',0,CURRENT_TIMESTAMP,'{$_SESSION['userPK']}');";
//echo $artefactNameAddQuery;
$db = new DatabaseConnection();
$conn = $db->createConnection();
$result = $db->setQuery($artefactNameAddQuery);
//$result1=$db->setQuery("call insertAttribute('$artefactCode','$_SESSION[type]')");
if ($result) {
echo "Artefact Added. Now just click your Artefact from Tree and add their attributes";
} else {
echo "Error in Query";
}
示例9: 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);
}
}
}
示例10: while
<div class='tile col-md-12'>
<div class='col-md-12 border-low'>
<div class="col-md-3 text-left heading-Bg">
<i class="fa fa-pencil-square-o fa-2x heading-Bg"></i> <span
style="font-size: 22px;">Condition report</span><br>
</div>
<div class="col-md-9 form-group" style="">
<?php
$query = "SELECT * FROM maintenancecycle where ArtefactCode ='{$artefactCode}'";
$result1 = $db->setQuery($query);
if ($result1->num_rows > 0) {
while ($rows = $result1->fetch_assoc()) {
$scheduledMaintainancedate = $rows['NextServiceDate'];
}
} else {
$scheduledMaintainancedate = "";
}
echo "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-5 text-right marginT10'>\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for='LocationDropdown'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLocation\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-7'>\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t <select id='LocationList' class='selectDropdown form-control'>\n\t\t\t\t\t\t\t\t\t\t\t\t";
$query = "select LocationPk,Code,Description from ArchiveLocation;";
if ($result = $db->setQuery($query)) {
echo "<option value=''> Select Location </option>";
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
?>
<option value='<?php
示例11: json_encode
<?php
include '../common/DatabaseConnection.php';
$db = new DatabaseConnection();
$db->createConnection();
$id = $_GET['id'];
$rolesDetail = array();
$sql = "SELECT code,description FROM role WHERE RolePk = '{$id}'";
$res = $db->setQuery($sql);
while ($row = $res->fetch_assoc()) {
$rolesDetail[] = $row;
}
echo json_encode($rolesDetail);
示例12: DatabaseConnection
<?php
session_start();
$user = $_SESSION['userPK'];
include '../common/DatabaseConnection.php';
$db = new DatabaseConnection();
$db->createConnection();
$role = $_GET['role'];
$ids = explode(',', substr($_GET['permission'], 1));
if ($db->setQuery("delete from role_page_mapping where rolefk='{$role}'")) {
$result;
for ($i = 0; $i < sizeof($ids); $i++) {
$sql = " INSERT INTO role_page_mapping\n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(NULL,\n\t\t\t\t\t\t\t'{$role}',\n\t\t\t\t\t\t\t'{$ids[$i]}',\n\t\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t\tCURRENT_TIMESTAMP,\n\t\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t\tCURRENT_TIMESTAMP)";
$result = $db->setQuery($sql);
}
if ($result) {
echo "success";
} else {
echo "fail";
}
} else {
echo "fail";
}
示例13: DatabaseConnection
// Starting Session
//include '';
include "../common/DatabaseConnection.php";
// Define $username and $password
$username = $_POST['username'];
$password = $_POST['password'];
// Establishing Connection with Server by passing server_name, user_id and password as a parameter
$obj = new DatabaseConnection();
$conn = $obj->createConnection();
// To protect MySQL injection for Security purpose
$username = stripslashes($username);
$password = stripslashes($password);
//$username = mysql_real_escape_string($username);
//$password = mysql_real_escape_string($password);
// SQL query to fetch information of registerd users and finds user match.
$query = $obj->setQuery("select * from user where abhyasiid='{$username}' AND password='{$password}' AND login_attempts < 3 and ActiveStatus='on'");
$rows = $query->num_rows;
if ($rows == 1) {
$_SESSION['artefactUser'] = $username;
header("location: ../dashboard/dashboard.php");
// Redirecting To Other Page
} else {
$data = $obj->setQuery("select * from user where abhyasiid='{$username}'");
$rows1 = $data->num_rows;
//echo "inside".$rows1;
if ($rows1 == 1) {
$obj->setLoginAttempts($username);
//echo "inside";
$num = $obj->getLoginAttempts($username);
if ($num >= 3) {
$obj->deactiveUser($username);
示例14: array
session_start();
include '../common/DatabaseConnection.php';
$params = array();
foreach ($_GET as $key => $value) {
$params[$key] = $value;
}
$artefactCode = $params['artefactCode'];
$scheduledKey = $params['scheduledKey'];
$location = $_SESSION['userLoc'];
$user = $_SESSION['userPK'];
$currentDate = date('Y-m-d');
$db = new DatabaseConnection();
$conn = $db->createConnection();
$taskListQuery = "\n\t\t\t\tINSERT INTO tasklist\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t(NULL,\n\t\t\t\t\t\t'{$artefactCode}',\n\t\t\t\t\t\t'{$scheduledKey}',\n\t\t\t\t\t\t'{$location}',\n\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t'{$currentDate}',\n\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\tCURRENT_TIMESTAMP,\n\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\tCURRENT_TIMESTAMP)";
$taskResult = $db->setQuery($taskListQuery);
$latRecordId = $conn->insert_id;
$reportQuery;
foreach ($params as $paramkey => $paramvalue) {
if ($paramkey != 'artefactCode' || $paramkey != 'scheduledKey') {
$reportQuery = "\n\t\t\t\t\t\t\tINSERT INTO conditionalreport\n\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t'NULL',\n\t\t\t\t\t\t\t\t'{$paramkey}',\n\t\t\t\t\t\t\t\t'{$latRecordId}',\n\t\t\t\t\t\t\t\t'{$paramvalue}',\n\t\t\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t\t\t'{$currentDate}',\n\t\t\t\t\t\t\t\t'{$user}',\n\t\t\t\t\t\t\t\t'{$currentDate}'\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t);\n\t\t\t\t\n\t\t\t\t";
$db->setQuery($reportQuery);
}
}
$updateSMsql = "UPDATE scheduledmaintenance\n\t\t\t\tSET CurrentStatus = 'Completed'\n\t\t\t\tWHERE ScheduleMaintenancePK = {$scheduledKey}";
$db->setQuery($updateSMsql);
if ($taskResult) {
echo 'success';
} else {
echo $reportQuery;
}
示例15: while
id='userTable'>
<thead>
<tr class='' style="background-color: #8bc2cb;">
<th>AbhyasiID</th>
<th>Location</th>
<th>FirstName</th>
<th>Lastname</th>
<th>Email Id</th>
<th>Role</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$result = $db->setQuery("select l.description,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tr.Description,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.firstname,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.lastname,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.userpk,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.AbhyasiID,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.EmailId ,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tu.ActiveStatus\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tfrom user u inner join archivelocation l \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton u.locationfk = l.locationpk\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tinner join role r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ton u.rolefk = r.rolepk;");
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$btntext = "";
if ($row['ActiveStatus'] == 'on') {
$btntext = "De-active";
} else {
$btntext = "Active";
}
echo "<tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['AbhyasiID'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['description'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['firstname'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['lastname'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['EmailId'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td>" . $row['Description'] . "</td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<td><input type='button' id='edit' class='btn btn-success editButton' name='" . $row['userpk'] . "' value='Edit' data-toggle='modal' data-target='#editModel' title='Click to Edit User Information'/> \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type='button' class='btn btn-danger deleteButton' id='delete' name='" . $row['userpk'] . "' value='" . $btntext . "' title='" . $btntext . " this user'/></td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t </tr>";
}
}
?>
</tbody>
</table>
</div>