本文整理汇总了PHP中Link::executeQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::executeQuery方法的具体用法?PHP Link::executeQuery怎么用?PHP Link::executeQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link::executeQuery方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNotification
/**
* Gets a notification from a user
*/
function getNotification()
{
// Gets customer profile information of this user
$link = new Link(false);
$query = $link->executeQuery("select * from customer_profile where email = '" . $_SESSION['loginId'] . "'", $_SERVER["SCRIPT_NAME"]);
// Breaks out of function early if notification failed
if (!$query) {
return "";
}
// Reads only row in
if ($row = mysql_fetch_array($query)) {
return $row["notification"];
}
// Default return if getting the notification value failed
return "";
}
示例2: Link
<?php
/*
Comments goes here!!
*/
$debug = false;
include 'link.php';
include 'travelHist.php';
$link = new Link($debug);
$travelHistObj = new TravelHistory();
session_start();
// Starting Session
if (isset($_POST['firstName'])) {
$link->executeQuery("UPDATE `customer_profile` SET `firstName` = '" . $_POST['firstName'] . "' WHERE `email` = '" . $_SESSION['loginId'] . "'", $_SERVER["SCRIPT_NAME"]);
}
if (isset($_POST['lastName'])) {
$link->executeQuery("UPDATE `customer_profile` SET `lastName` = '" . $_POST['lastName'] . "' WHERE `email` = '" . $_SESSION['loginId'] . "'", $_SERVER["SCRIPT_NAME"]);
}
if (isset($_POST['street'])) {
$link->executeQuery("UPDATE `customer_profile` SET `street` = '" . $_POST['street'] . "' WHERE `email` = '" . $_SESSION['loginId'] . "'", $_SERVER["SCRIPT_NAME"]);
}
if (isset($_POST['city'])) {
$link->executeQuery("UPDATE `customer_profile` SET `city` = '" . $_POST['city'] . "' WHERE `email` = '" . $_SESSION['loginId'] . "'", $_SERVER["SCRIPT_NAME"]);
}
if (isset($_POST['state'])) {
$link->executeQuery("UPDATE `customer_profile` SET `state` = '" . $_POST['state'] . "' WHERE `email` = '" . $_SESSION['loginId'] . "'", $_SERVER["SCRIPT_NAME"]);
}
if (isset($_POST['zip'])) {
$link->executeQuery("UPDATE `customer_profile` SET `zip` = '" . $_POST['zip'] . "' WHERE `email` = '" . $_SESSION['loginId'] . "'", $_SERVER["SCRIPT_NAME"]);
}
if (isset($_POST['phone'])) {
示例3: Link
<?php
/*
* populating user data into database
*/
$debug = false;
session_start();
print "";
//this is neccessary to clear the httpXMLfeedback field so the validation won't double read the same error
if (isset($_POST['verifyEmail'])) {
include 'link.php';
$link = new Link($debug);
$result = $link->executeQuery("select `email` from `customer_profile`", $_SERVER["SCRIPT_NAME"]);
print "email";
//start by assuming the email entered is valid
while ($row = mysql_fetch_array($result)) {
if ($_POST['verifyEmail'] == $row['email'] || !filter_var($_POST['verifyEmail'], FILTER_VALIDATE_EMAIL)) {
print " not";
//if the entered email matches ones found in database, then mark it invalid
break;
}
}
print " valid";
} else {
include "headHTML.html";
//data parameters to be pushed into database
$_SESSION['firstName'] = $_POST['firstName'];
$_SESSION['lastName'] = $_POST['lastName'];
$_SESSION['street'] = $_POST['street'];
$_SESSION['city'] = $_POST['city'];
$_SESSION['state'] = $_POST['state'];
示例4: Link
<?php
/*
Comments goes here!!
*/
$debug = false;
include 'link.php';
$link = new Link($debug);
session_start();
if (isset($_POST['notification'])) {
$model = $_POST['notification'];
}
//first determine the plane's location so we can look up the waiting list while its in that airport
$result = $link->executeQuery("select * from `planes` WHERE `model` = '" . $model . "'", $_SERVER["SCRIPT_NAME"]);
while ($row = mysql_fetch_array($result)) {
$airport = $row['currentLocation'];
}
//retrieving the current location
//then we retrieve the waiting list from that aitport
$result = $link->executeQuery("select * from `airport_locations` WHERE `airport` = '" . $airport . "'", $_SERVER["SCRIPT_NAME"]);
while ($row = mysql_fetch_array($result)) {
$planeWaitList = unserialize($row['planeWaitList']);
}
//retrieving the waiting list
for ($planeWaitList->rewind(); $planeWaitList->valid(); $planeWaitList->next()) {
$memberWaitList = $planeWaitList->current();
$plane = $memberWaitList->offsetGet(0);
//we're only interested in the first element of the list, since the first element of the memberWaitList is the model of the plane
if ($plane == $model) {
for ($memberWaitList->rewind(); $memberWaitList->valid(); $memberWaitList->next()) {
if ($memberWaitList->current() == $_SESSION['loginId']) {
示例5: Link
$debug = false;
include 'link.php';
include 'travelHist.php';
$link = new Link($debug);
$travelHistObj = new TravelHistory();
session_start();
$_SESSION['depart'] = $_POST['depart'];
$_SESSION['arrive'] = $_POST['arrive'];
$_SESSION['duration'] = $_POST['duration'];
$_SESSION['startDate'] = $_POST['startDate'];
$_SESSION['returnDate'] = $_POST['returnDate'];
$originalReturnDate = $_SESSION['returnDate'];
$_SESSION['returnDate'] = date('Y-m-d', strtotime($_SESSION['returnDate']));
$_SESSION['model'] = $_POST['model'];
$email = $_SESSION['loginId'];
$result = $link->executeQuery("select * from `customer_profile` WHERE `email` = '" . $email . "'", $_SERVER["SCRIPT_NAME"]);
while ($row = mysql_fetch_array($result)) {
$serializedTravelHistData = $row['travelHist'];
}
$travelHistList = unserialize($serializedTravelHistData);
if ($travelHistList == NULL) {
$travelHistList = new SplDoublyLinkedList();
$link->executeQuery("UPDATE `customer_profile` SET `travelHist` = '" . serialize(new SplDoublyLinkedList()) . "' WHERE `email` = '" . $_SESSION['loginId'] . "'", $_SERVER["SCRIPT_NAME"]);
}
if (count($travelHistList) > 50) {
$travelHistList->offsetUnset(0);
}
//removing the first item from the list
preg_match('/^[^,]*/', $_SESSION['depart'], $matches);
//(patern, subject, matchesFound), this is the format of the regex
$travelHistObj->depart = $matches[0];
示例6: Link
<?php
/*
Comments goes here!!
*/
$debug = false;
include 'link.php';
$link = new Link($debug);
session_start();
if (isset($_POST['airport'])) {
$_SESSION['airport'] = $_POST['airport'];
}
print "<option value = ''>Select A Plane</option>";
$result = $link->executeQuery("select * from `planes` WHERE `currentLocation` = '" . $_SESSION['airport'] . "'", $_SERVER["SCRIPT_NAME"]);
$rows = mysql_num_rows($result);
// available plane
if ($rows > 0) {
while ($row = mysql_fetch_array($result)) {
$value = $row['model'] . "|1";
print "<option value = \"" . $value . "\">✓ " . $row['model'] . "</option>";
}
}
$result = $link->executeQuery("select * from `planes` WHERE `currentLocation` != '" . $_SESSION['airport'] . "'", $_SERVER["SCRIPT_NAME"]);
$rows = mysql_num_rows($result);
// not available planes
if ($rows > 0) {
while ($row = mysql_fetch_array($result)) {
$value = $row['model'] . "|0";
print "<option value = \"" . $value . "\">✗ " . $row['model'] . "</option>";
}
}
示例7: basename
$uploadOk = 0;
}
}
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file " . basename($_FILES["fileToUpload"]["name"]) . " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
$link->executeQuery("UPDATE `customer_profile` SET `avatar` = '" . basename($_FILES["fileToUpload"]["name"]) . "' WHERE `email` = '" . $_SESSION['loginId'] . "'", $_SERVER["SCRIPT_NAME"]);
print "<META http-equiv = \"REFRESH\" content = \"0; userprofile.php\">";
示例8: Link
<?php
$debug = false;
include '../link.php';
$link = new Link($debug);
$result = $link->executeQuery("select * from `admin_setting`", $_SERVER["SCRIPT_NAME"]);
while ($row = mysql_fetch_array($result)) {
$demo = $row['lateFeeDemo'];
}
if ($demo == "off") {
$link->executeQuery("UPDATE `admin_setting` SET `lateFeeDemo` = 'on' WHERE `lateFeeDemo` = 'off'", $_SERVER["SCRIPT_NAME"]);
}
if ($demo == "on") {
$link->executeQuery("UPDATE `admin_setting` SET `lateFeeDemo` = 'off' WHERE `lateFeeDemo` = 'on'", $_SERVER["SCRIPT_NAME"]);
}
print "<META http-equiv = \"REFRESH\" content = \"0; admin.php\">";
exit;
示例9: floatval
$field = $_SESSION['field'];
}
if (isset($_SESSION['email'])) {
$email = $_SESSION['email'];
}
unset($_SESSION['intent']);
unset($_SESSION['email']);
unset($_SESSION['field']);
unset($_SESSION['newVal']);
if ($intent == "addNewAirportLocation") {
if ($airport != '' && $lon != '' && $lat != '') {
if (is_numeric($lon) && is_numeric($lat)) {
$lon = floatval($lon);
$lat = floatval($lat);
$sql = "INSERT INTO `airport_locations` (`airport`, `long`, `lat`) VALUES ('" . $airport . "', '" . $lon . "', '" . $lat . "')";
$link->executeQuery($sql, $_SERVER["SCRIPT_NAME"]);
}
}
} else {
if ($intent == "listAirports") {
print "<br><table border='0px'>";
print "<tr>";
print "<td>Delete </td>";
print "<td>Airport</td>";
print "</tr>";
$result = $link->executeQuery("SELECT * FROM `airport_locations`", $_SERVER["SCRIPT_NAME"]);
while ($row = mysql_fetch_array($result)) {
print "<tr><td><a href = \"javascript: deleteAirport('" . $row['airport'] . "');\" style = \"color: red\">delete</td>" . "<td>" . $row['airport'] . "</td></tr>";
}
print "</table><br>";
print "<a style = \"float:left\" href = \"javascript: restoreAdminContentPanel();\">Return</a>";
示例10: Link
/*
Comments goes here!!
*/
$debug = false;
include 'link.php';
$link = new Link($debug);
session_start();
if (isset($_POST['airport']) && isset($_POST['model']) && isset($_POST['intent'])) {
$airport = $_POST['airport'];
$model = $_POST['model'];
$intent = $_POST['intent'];
/*
* these two block perform autonomic repair in case the data structure in the database is broken
*/
$result = $link->executeQuery("select * from `airport_locations` WHERE `airport` = '" . $airport . "'", $_SERVER["SCRIPT_NAME"]);
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_array($result)) {
$planeWaitList = unserialize($row['planeWaitList']);
}
if ($planeWaitList == NULL) {
$planeWaitList = new SplDoublyLinkedList();
//create a new plane list for this airport
$memberWaitList = new SplDoublyLinkedList();
//create a new member waitlist to be put into the plane wait list
$memberWaitList->push($model);
//the first element of the member wait list will always the model of the plane
//$memberWaitList -> push($_SESSION['loginId']); //every element after the first element of the member wait list will be the waiting member
$planeWaitList->push($memberWaitList);
//push the member wait list into the plane wait list
$link->executeQuery("UPDATE `airport_locations` SET `planeWaitList` = '" . serialize($planeWaitList) . "' WHERE `airport` = '" . $airport . "'", $_SERVER["SCRIPT_NAME"]);
示例11: Link
<?php
/*
Comments goes here!!
*/
$debug = false;
include 'link.php';
$link = new Link($debug);
session_start();
$email = $_SESSION['loginId'];
$_SESSION['diffDays'] = $_POST['diffDays'];
//not sure what to do with this...
$_SESSION['feeOwe'] = $_POST['feeOwe'];
//check what plane they checked out
$sql = "select * from `customer_profile` WHERE `email` = '" . $email . "'";
$result = $link->executeQuery($sql, $_SERVER["SCRIPT_NAME"]);
while ($row = mysql_fetch_array($result)) {
$_SESSION['model'] = $row['plane'];
$_SESSION['balance'] = $row['balance'];
//use to calculate with the late fee, late fee will be added to total balance
}
$_SESSION['balance'] += $_SESSION['feeOwe'];
//update their profile by removing the plane entry, and mark them as having no plane check out, also put in the new total latefee
$sql = "UPDATE `customer_profile` SET `checkOutStatus` = '0', `plane` = '', `balance` = " . $_SESSION['balance'] . " WHERE `email` = '" . $email . "'";
$link->executeQuery($sql, $_SERVER["SCRIPT_NAME"]);
$sql = "select * from `planes` WHERE `model` = '" . $_SESSION['model'] . "'";
$result = $link->executeQuery($sql, $_SERVER["SCRIPT_NAME"]);
while ($row = mysql_fetch_array($result)) {
$_SESSION['currentLocation'] = $row['returnTo'];
}
$result = $link->executeQuery("select * from `airport_locations` WHERE `airport` = '" . $_SESSION['currentLocation'] . "'", $_SERVER["SCRIPT_NAME"]);