本文整理汇总了PHP中ORM::raw_execute方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::raw_execute方法的具体用法?PHP ORM::raw_execute怎么用?PHP ORM::raw_execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORM
的用法示例。
在下文中一共展示了ORM::raw_execute方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
$items[] = $item["result"];
}
echo implode(";", $items);
});
$app->post('/genv/payhulu', function ($request, $response) {
$uid = $_SESSION['uid'];
$amount = $this->request->getParam("amount");
try {
ORM::get_db()->setAttribute(PDO::ATTR_AUTOCOMMIT, 0);
ORM::get_db()->beginTransaction();
//减去余额
$sql = vsprintf("UPDATE %s SET `balance` = balance-%d WHERE `uid` = %d and `balance`>=%d ", array(table("members_points"), $amount, $uid, $amount));
ORM::raw_execute($sql);
//增加积分;
$sql = vsprintf("UPDATE %s SET `points` = points+%d WHERE `uid` = %d ", array(table("members_points"), $amount, $uid));
ORM::raw_execute($sql);
echo ORM::get_last_query();
//
// Order::deduct_stock($order['coohua_id'], $order['product_id'], $order['order_code']);
// ORM::raw_execute("UPDATE `order` SET `check` = 5 WHERE `order_code` = ? and `check`=4 ", array($order['order_code']));
ORM::get_db()->commit();
ORM::get_db()->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
} catch (Exception $e) {
//dump($e);
ORM::get_db()->rollBack();
}
});
function listDir($dir)
{
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
示例2: array
<?php
if (isset($_GET["buy_tickets"]) && !empty($_GET["buy_tickets"])) {
$travel_id = $_GET["TRAVEL_ID"];
ORM::raw_execute("UPDATE seats " . "SET status = :status_value " . "WHERE travel_id = :travel_id " . "AND updated_by = :user_id", array("status_value" => 'U', "travel_id" => $travel_id, "user_id" => 'user_id'));
}
?>
<script>
function ajax_post(seat_number){
// Create our XMLHttpRequest object
var hr = new XMLHttpRequest();
// Create some variables we need to send to our PHP file
var url = "reserve_seat.php";
//var fn = document.getElementById("1_1").innerHTML;
var fn = seat_number.innerHTML;
var user = "user_id";
var travel_id = <?php
echo $_GET["TRAVEL_ID"];
?>
;
var vars = "reserve_seat=true&seat_number="+fn+"&user_id="+user+"&travel_id="+travel_id+"&status_value=A";
//check if seat is not sold or reserved
hr.open("POST", "reserve_seat.php", true);
// Set content type header information for sending url encoded variables in the request
hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
// Access the onreadystatechange event for the XMLHttpRequest object
hr.onreadystatechange = function() {
示例3: prefs
/**
* @public
*/
static function prefs($prefs)
{
global $app;
$req = $app->request();
if (!has_session()) {
throw new AccessException();
}
if ($req->isGet()) {
return current_user()->getPrefs(true);
}
if ($req->isPost()) {
// preferences are set by the client, so we allow pretty much
// anything to be stored there - don't forget this!
// it's really designed for storing flags, like whether or not
// a particular screen or message has been seen before
foreach ($prefs as $pname => $value) {
$name = 'pref_' . trim($pname);
if (strlen($name) > UserSetting::MAX_NAME_LENGTH) {
throw new Exception("Preference name [{$pname}] is too long");
}
if (!preg_match('/^[\\w_-]+$/', $name)) {
throw new Exception("Invalid preference name [{$pname}] is too long");
}
ORM::raw_execute("\n INSERT INTO user_setting (\n `user_id`,\n `name`,\n `value`\n ) VALUES (\n ?, ?, ?\n ) ON DUPLICATE KEY UPDATE\n `user_id` = VALUES(`user_id`),\n `name` = VALUES(`name`),\n `value` = VALUES(`value`) \n ", array(current_user()->id, $name, maybe_serialize($value)));
}
}
if ($req->isDelete()) {
foreach ($prefs as $pname => $value) {
$name = 'pref_' . trim($pname);
ORM::raw_execute("\n DELETE FROM user_setting \n WHERE\n `user_id` = ?\n AND `name` = ?\n LIMIT 1\n ", array(current_user()->id, $name));
}
}
}
示例4: update_resume_num
function update_resume_num($id)
{
$count = resume_log_num($id);
\ORM::raw_execute(vsprintf("update %s set num=%d where id=%d", array(table("resume_temp"), $count, $id)));
if ($count >= 3) {
update_resume_status($id);
//如果有三条都通过的记录,直接导入简历;
$rs = \ORM::for_table(table("resume_check_log"))->where("rid", $id)->where("pass", 1)->find_array();
if ($rs && count($rs) >= 3) {
import_resume_temp($id);
}
}
}
示例5: raw_execute
public function raw_execute($query, $parameters = array())
{
return \ORM::raw_execute($query, $parameters = array(), $this->connectionName);
}
示例6: date_default_timezone_set
<?php
require 'setup.php';
date_default_timezone_set('America/Mexico_City');
if (isset($_POST["reserve_seat"]) && !empty($_POST["reserve_seat"])) {
$travel_id = $_POST["travel_id"];
$seat_number = $_POST["seat_number"];
$status_value = $_POST['status_value'];
$user_id = $_POST['user_id'];
$check = ORM::for_table('seats')->select('seats.status')->where(array('travel_id' => $travel_id, 'seat_number' => $seat_number))->find_one();
$status = $check->status;
$user_check = ORM::for_table('seats')->select('seats.updated_by')->where(array('travel_id' => $travel_id, 'seat_number' => $seat_number))->find_one();
$user = $user_check->updated_by;
if ($status === '0') {
ORM::raw_execute("UPDATE seats " . "SET status = :status_value " . ",updated_by = :updated_by " . "WHERE travel_id = :travel_id " . "AND seat_number = :seat_number ", array("status_value" => $status_value, "updated_by" => $user_id, "travel_id" => $travel_id, "seat_number" => $seat_number));
header("Content-type: text/xml");
echo '<this><is><color>#FFFF00</color></is></this>';
}
if ($status === 'A' && $user === $user_id) {
ORM::raw_execute("UPDATE seats " . "SET status = :status_value " . ", updated_by= :updated_by " . "WHERE travel_id = :travel_id " . "AND seat_number = :seat_number ", array("status_value" => '0', "updated_by" => '', "travel_id" => $travel_id, "seat_number" => $seat_number));
header("Content-type: text/xml");
echo '<this><is><color>#006600</color></is></this>';
}
/*
else {
echo 'Alguien mas acaba de apartar este asiento';
}
*/
}
示例7: VALUES
$ins = ORM::raw_execute("INSERT INTO `modules` VALUES (1, 'tv_shows', 'TV shows', 1)");
$ins = ORM::raw_execute("INSERT INTO `modules` VALUES (2, 'movies', 'Movies', 1)");
$ins = ORM::raw_execute("INSERT INTO `modules` VALUES (7, 'submit_links', 'Submit links', 1)");
$ins = ORM::raw_execute("INSERT INTO `modules` VALUES (6, 'requests', 'Requests', 1)");
print "<span style='color:#00aa00'>Success</span><br />";
?>
Adding default settings...
<?php
$ins = ORM::raw_execute("INSERT INTO `settings` VALUES (1, 'default_language', 'en')");
$ins = ORM::raw_execute("INSERT INTO `settings` VALUES (2, 'maxtvperpage', '50')");
$ins = ORM::raw_execute("INSERT INTO `settings` VALUES (3, 'maxmoviesperpage', '50')");
$ins = ORM::raw_execute("INSERT INTO `settings` VALUES (4, 'countdown_free', '30')");
$ins = ORM::raw_execute("INSERT INTO `settings` VALUES (5, 'countdown_user', '0')");
$ins = ORM::raw_execute("INSERT INTO `settings` VALUES (6, 'seo_links', '1')");
$ins = ORM::raw_execute("INSERT INTO `settings` VALUES (7, 'smart_bar', '0')");
print "<span style='color:#00aa00'>Success</span><br />";
?>
Changing Admin Panel Name...
<?php
rename(realpath(dirname(__FILE__)) . '/../control', realpath(dirname(__FILE__)) . '/../' . $_SESSION['admin_folder']);
print "<span style='color:#00aa00'>Success</span><br />";
?>
Congratulation. Your site is all set up<br /><br />
Next steps:<br /><br />
<ul>
<li><a href="<?php
print $_SESSION['site_url'];
示例8: date_default_timezone_set
// to let static ember help pages work even if unconfigured
date_default_timezone_set(defined('AMTC_TZ') ? AMTC_TZ : 'Europe/Berlin');
set_include_path(get_include_path() . PATH_SEPARATOR . AMTC_WEBROOT . '/lib' . PATH_SEPARATOR . AMTC_WEBROOT . '/lib/db-model');
spl_autoload_extensions('.php');
spl_autoload_register();
require 'idiorm.php';
require 'paris.php';
require 'Slim/Slim.php';
// Initialize http://j4mie.github.io/idiormandparis/
if (defined("AMTC_PDOSTRING")) {
ORM::configure(AMTC_PDOSTRING);
ORM::configure('username', AMTC_DBUSER);
ORM::configure('password', AMTC_DBPASS);
// small hack to enforce constraint checking for sqlite; requires 3.6+
if (substr(AMTC_PDOSTRING, 0, 6) == 'sqlite') {
ORM::raw_execute('PRAGMA foreign_keys = ON');
}
}
// Initialize http://www.slimframework.com/
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->config('debug', false);
// false enables custom error handler below
$app->response()->header('Content-Type', 'application/json;charset=utf-8');
$app->notFound(function () {
echo json_encode(array('error' => 'Not found'));
});
$app->error(function (\Exception $e) {
echo strlen($e->getMessage()) > 128 ? substr($e->getMessage(), 0, 128) . '...' : $e->getMessage();
});
class SlimUtil