本文整理汇总了PHP中executePlainSQL函数的典型用法代码示例。如果您正苦于以下问题:PHP executePlainSQL函数的具体用法?PHP executePlainSQL怎么用?PHP executePlainSQL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了executePlainSQL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dropDownQueryForRental
function dropDownQueryForRental($attr_name, $table, $target)
{
echo "<h2> Rent Equipment </h2>";
echo "<form method=\"POST\" action=\"" . $target . "\"><select name =\"equip\">";
echo "<option value=\"\">Select...</option>";
$string = "select " . $attr_name . " from " . $table;
$result = executePlainSQL($string);
while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
echo "<option value=\"" . $row[0] . "\">" . $row[0] . "</option>";
}
echo "<input type=\"text\" value=\"Quantity...\" name=\"qty\">";
echo "<input type=\"text\" value=\"Member ID\" name=\"memID\">";
echo "</select><input type=\"submit\" class=\"pure-button\" value=\"Rent\">";
echo "</form>";
}
示例2: populateTables
function populateTables()
{
require 'setup.php';
echo "<b>Populating tables...</b> <br>";
// execute all "INSERT INTO" SQL statements in setup.php
foreach ($insertArray as &$subArray) {
foreach ($subArray as &$subStatement) {
global $db_conn;
// for variable scope in inner loop
executePlainSQL($subStatement);
global $verbose;
if ($verbose) {
echo $subStatement . "<br>";
}
OCICommit($db_conn);
}
if ($verbose) {
echo "<br>";
}
}
}
示例3: executePlainSQL
} else {
$update_pw_q = "UPDATE Customer SET password = '" . $_POST['new_pw'] . "' WHERE cid = " . $cid;
executePlainSQL($update_pw_q);
OCICommit($db_conn);
?>
<script type="text/javascript">
alert("Password successfully updated!");
location: "profile.php";
</script>
<?php
}
}
}
// Fetch the customer profile based on the cid from cookies
$q = "select * from Customer where cid = '" . $cid . "'";
$result = executePlainSQL($q);
$row = OCI_Fetch_Array($result, OCI_BOTH);
$cname = $row['CNAME'];
$email = $row['EMAIL'];
$addr = $row['ADDRESS'];
$phone = $row['PHONE'];
$passport_country = $row['PASSPORT_COUNTRY'];
$passport_num = $row['PASSPORT_NUM'];
OCILogoff($db_conn);
}
?>
<div class="content-customer-area">
<p>Edit your profile:</p>
<form class="pure-form pure-form-aligned" method="POST" action="profile.php">
<fieldset>
示例4: printLayOver
function printLayOver($firstid, $secondid)
{
$layover = oci_fetch_row(executePlainSQL("select F2.departtime-F1.arrivaltime from Flight F1, Flight F2\n\t\t\t\t\t\t\t\t\twhere F1.fid='{$firstid}' AND F2.fid='{$secondid}'"));
$layovertime = parseDate($layover[0], 2);
echo "<br>Lay over for {$layovertime}";
}
示例5: executePlainSQL
// Insert reservation tuple into make_res
// (resid, cid, pclass, ticket_num)
executePlainSQL("insert into make_res values (\r\n\t\t\t\t\t\tresid_sequence.nextval," . $_COOKIE['cid'] . "," . $_POST['makeres_classint'] . "," . $_POST['makeres_numtickets'] . ")");
OCICommit($db_conn);
// res_includes(fid, resid, resorder)
$fids = array($_POST['fid1'], $_POST['fid2'], $_POST['fid3']);
foreach ($fids as $key => $value) {
//echo $fids[$key]."<br>";
if ($fids[$key] != "") {
executePlainSQL("insert into res_includes values (" . $value . ",\r\n\t\t\t\t\tresid_sequence.currval," . number_format($key + 1) . ")");
}
}
OCICommit($db_conn);
executePlainSQL("insert into payment values(\r\n\t\t\t\tpayid_sequence.nextval," . $_POST['credit'] . "," . $_COOKIE['cid'] . ")");
OCICommit($db_conn);
executePlainSQL("insert into deter_pay values(\r\n\t\t\t\tpayid_sequence.currval,\r\n\t\t\t\tresid_sequence.currval," . $_POST['makeres_totalcost'] . ")");
OCICommit($db_conn);
// Confirmation dialog
?>
<script type="text/javascript">
alert("Payment successful. Proceed to adding bags");
location = "baggage.php";
</script>
<?php
} else {
//print_r($res);
echo "Your flight itinerary:";
printDetails($res, 0, 0);
?>
<br><br>The summary of your ticket order:
<table class="pure-table">
示例6: array
$tuple = array(":bind1" => $_POST['oldName'], ":bind2" => $_POST['newName']);
$alltuples = array($tuple);
executeBoundSQL("update tab1 set name=:bind2 where name=:bind1", $alltuples);
OCICommit($db_conn);
} else {
if (array_key_exists('dostuff', $_POST)) {
}
}
}
}
if ($_POST && $success) {
//POST-REDIRECT-GET -- See http://en.wikipedia.org/wiki/Post/Redirect/Get
header("location: oracle-test.php");
} else {
// Select data...
$result = executePlainSQL("select * from Customer");
printResult($result);
}
//Commit to save changes...
OCILogoff($db_conn);
} else {
echo "cannot connect";
$e = OCI_Error();
// For OCILogon errors pass no handle
echo htmlentities($e['message']);
}
/* OCILogon() allows you to log onto the Oracle database
The three arguments are the username, password, and database
You will need to replace "username" and "password" for this to
to work.
all strings that start with "$" are variables; they are created
示例7: executePlainSQL
$deletesearchby = $_POST['deletesearchby'];
$searchedvalue = $_POST['searchedvalue'];
executePlainSQL("delete from {$tablename}" . " where {$deletesearchby} = '{$searchedvalue}'");
OCICommit($db_conn);
// save selection for next load
setcookie("deletesearchby", $deletesearchby);
}
if ($_POST && $success) {
//POST-REDIRECT-GET -- See http://en.wikipedia.org/wiki/Post/Redirect/Get
header("location: admin.php");
// default will check if there is any table already selected and output that
} else {
if (strcmp($_COOKIE['tabchoice'], "") !== 0 && strcmp($_COOKIE['tabchoice'], "default") !== 0) {
$tabchoice = $_COOKIE['tabchoice'];
$cols = executePlainSQL("select column_name from user_tab_columns where table_name = '{$tabchoice}'");
$data = executePlainSQL("select * from " . $tabchoice);
printResults($tabchoice, $cols, $data);
// retrieve past delete/update selection from cookie for this load
$updatesearchby = $_COOKIE['updatesearchby'];
$deletesearchby = $_COOKIE['deletesearchby'];
// delete them as only needed for one load
setcookie("updatesearchby", "", time() - 3600);
setcookie("deletesearchby", "", time() - 3600);
// set the drop down lists according to the cookie (last delete/update selections)
echo "<script>document.getElementById('tabchoice').value='{$tabchoice}'</script>";
if (strcmp($_COOKIE['updatesearchby'], "") !== 0) {
echo "<script>document.getElementById('updatesearchby').value='{$updatesearchby}'</script>";
}
if (strcmp($_COOKIE['deletesearchby'], "") !== 0) {
echo "<script>document.getElementById('deletesearchby').value='{$deletesearchby}'</script>";
}
示例8: oci_close
oci_close($db_conn);
}
}
if (isset($_POST['BusinessLogin'])) {
if (empty($_POST['businessName']) || empty($_POST['businessPwd'])) {
$error = "Business Name or Password is invalid";
} else {
// connect to DB
$db_conn = OCILogon("ora_" . $csid, "a" . $studentnum, "ug");
// now connected
if ($db_conn) {
// grab the information needed for login
$inputname = $_POST['businessName'];
$inputpwd = $_POST['businessPwd'];
// query for information obtained
$s = executePlainSQL("select count (*)\n from Business \n where BusinessName = '{$inputname}' AND \n PasswordHash = '{$inputpwd}'");
$result = oci_fetch_array($s);
if ($result[0] == 1) {
$_SESSION['login_business'] = $inputname;
// Initializing Session
header("location: business_profile.php");
// Redirecting To Other Page
} else {
$error = "Business Name or Password is invalid";
}
} else {
echo "cannot connect";
$e = OCI_Error();
// For OCILogon errors pass no handle
echo htmlentities($e['message']);
}
示例9: ini_set
<?php
//THIS PHP FILE IS TO DELETE USER OR LOG OUT
require 'template.php';
ini_set('session.save_path', '/home/i/i5a8/');
session_start();
if (isset($_SESSION['username'])) {
if (isset($_GET['logout'])) {
session_destroy();
} else {
executePlainSQL("delete from party where partyid='{$_SESSION['username']}'");
OCICommit($db_conn);
OCILogoff($db_conn);
session_destroy();
}
}
header('Location: user.php');
示例10: printResult
function printResult($result)
{
//prints results from a select statement
echo "<br>Employee Info<br>";
echo "<table class='table table-striped'>";
echo "<tr><th>Username</th>" . " " . "<th>Wage</th>" . " " . "<th>Job Type</th>" . " " . "<th>Work Schedule</th></tr>";
while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
echo "<tr><td>" . $row["USERNAME"] . " </td><td>" . $row["WAGE"] . " </td><td>" . $row["JOBT"] . "</td><td>" . " " . $row["WORKS"] . "</td></tr>";
//or just use "echo $row[0]"
}
echo "</table>";
}
// Connect Oracle...
if ($db_conn) {
$users = $_SESSION["username"];
printResult(executePlainSQL("select * from employee where username = '{$users}'"));
OCICommit($db_conn);
}
?>
</font>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../js/bootstrap.min.js"></script>
</body>
<?php
} else {
echo "ACCESS DENIED";
}
示例11: executePlainSQL
}
if (array_key_exists('Value', $_POST)) {
$users = $_POST['username'];
$amount = $_POST['amount'];
$result = executePlainSQL("select username from customers where username = '{$users}'");
$numrows = oci_fetch_all($result, $res);
if ($numrows == 0) {
echo "<div class='alert alert-danger' role='alert'>";
echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
echo "<span class='sr-only'>Error:</span>";
echo "Invalid User";
echo $amount = $_POST['amount'];
echo "</div>";
}
if ($numrows == 1) {
executePlainSQL("update customers set credit = {$amount} where username = '{$users}'");
header("location: index.php");
}
}
OCICommit($db_conn);
//Commit to save changes...
OCILogoff($db_conn);
// printResult($result);
//Commit to save changes...
} else {
$e = OCI_Error();
// For OCILogon errors pass no handle
echo "<div class='alert alert-danger' role='alert'>";
echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
echo "<span class='sr-only'>Error:</span>";
echo htmlentities($e['message']);
示例12: minAvg
function minAvg()
{
$min = executePlainSQL("SELECT min(avg(pp)) FROM moves GROUP BY type");
echo "<div class='Pokeguide'>";
echo "<table>";
echo "<tr>";
echo "<td>Lowest Average PP</td>";
echo "<td>Type</td>";
echo "</tr>";
echo "<tr>";
$row = OCI_Fetch_Array($min, OCI_BOTH);
echo "<td>" . $row[0] . "</td><td>Dragon</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
}
示例13: strtolower
Location: <input type="text" name="location">
<input type="submit" value="search">
</form>
<br>
<?php
//SEARCH
$location = strtolower($_GET["location"]);
if ($location != null) {
//$pokemon = ucfirst($_POST["pokemon"]);
$locations = array_map('ucfirst', explode(" ", $location));
$location = implode(" ", $locations);
$result = executePlainSQL("SELECT * FROM location WHERE lname = '" . $location . "' OR lname LIKE '%" . $location . "%'");
} else {
$result = executePlainSQL("SELECT * FROM location");
}
printLocation($result);
//Print result
function printLocation($result)
{
echo "<div class='Pokeguide'>";
echo '<table>';
echo '<tr><td>Location</td><td>Description</td></tr>';
while ($row = OCI_Fetch_Array($result, OCI_BOTH)) {
if (strpos($row[0], 'Evolve') === false and strpos($row[0], 'LName') === false) {
echo '<tr>';
echo '<td>' . $row[0] . '</td>';
echo '<td>' . $row[1] . '</td>';
echo '</tr>';
}
示例14: executePlainSQL
<head>
<title>RegSys</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="css/style.css" rel="stylesheet" type="css/css" media="all" />
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
<link href='http://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Exo+2:400,700,100' rel='stylesheet' type='text/css'>
</head>
<body>
<!--content-->
<h1>RegSys 1.0</h1>
<h2>Recreation Centre Registration System</h2>
<p><?php
echo "Hello, ";
$getName = "SELECT name \n\t\t\t\tFROM employee\n\t\t\t\tWHERE employee.empID = '" . $_SESSION["empID"] . "' \n\t\t\t\tAND employee.password = '" . $_SESSION["password"] . "'";
$result = executePlainSQL($getName);
$row = oci_fetch_array($result, OCI_BOTH);
if ($row["NAME"]) {
echo $row["NAME"];
$loginName = "Logout";
$loginAction = "window.location.href='logout.php'";
} else {
echo "Guest!";
$loginName = "Login";
$loginAction = "window.location.href='login.php'";
}
?>
</p>
<ul class="content">
<li class="menu">
<ul>
示例15: OCICommit
//the function takes a list of lists
// Update data...
//executePlainSQL("update tab1 set nid=10 where nid=2");
// Delete data...
//executePlainSQL("delete from tab1 where nid=1");
OCICommit($db_conn);
}
}
}
}
if ($_POST && $success) {
//POST-REDIRECT-GET -- See http://en.wikipedia.org/wiki/Post/Redirect/Get
header("location: oracle-test.php");
} else {
// Select data...
$result = executePlainSQL("select * from tab1");
printResult($result);
}
//Commit to save changes...
OCILogoff($db_conn);
} else {
echo "cannot connect";
$e = OCI_Error();
// For OCILogon errors pass no handle
echo htmlentities($e['message']);
}
/* OCILogon() allows you to log onto the Oracle database
The three arguments are the username, password, and database
You will need to replace "username" and "password" for this to
to work.
all strings that start with "$" are variables; they are created