本文整理汇总了PHP中database::get方法的典型用法代码示例。如果您正苦于以下问题:PHP database::get方法的具体用法?PHP database::get怎么用?PHP database::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database
的用法示例。
在下文中一共展示了database::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$dbobj = new database();
$this->db = $dbobj->get();
$this->session = new session($this->db);
$this->email = new email();
}
示例2: switch
?>
">ผู้สั่งซื้อ</a>
</th>
<th id="user-grid_c4" style="text-align: right;">
<a class="sort-link" href="<?php
echo $uri;
?>
">ราคา(บาท)</a>
</th>
<th class="button-column" id="user-grid_c6"> </th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
while ($rs_or = $db->get($query_or_page)) {
$tr = $i % 2 == 0 ? "odd" : "even";
//สถานะ
switch ($rs_or['order_status']) {
case 'pending':
$order_status = 'ยังไม่ชำระเงิน';
$btnorder = 'แจ้งชำระเงิน';
$btnstat = '';
break;
case 'payments':
$order_status = 'กำลังจัดส่งสินค้า';
$btnorder = 'ชำระเงินแล้ว';
$btnstat = 'disabled';
break;
case 'shipping':
$order_status = 'จัดส่งสินค้าแล้ว';
示例3: __construct
/**
* Table builder constructor.
* Database class initialization, don't create too many instances of table builder,
* because it will create many database instances which will decrease performance.
* By default this class would create a `id` field INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, unless
* you'll set second parameter FALSE.
*
* @param PDO|null $db - PDO instance (it can be a \helper\database instance)
* @param boolean $id - A flag to add or not to add `id` field automatically
*/
public function __construct(PDO $db = NULL, $id = TRUE)
{
// If database is not given, create new database instance.
// database is in the same namespace, we don't need to specify namespace
$this->_db = !$db ? database::get() : $db;
if ($id === TRUE) {
$this->addField('id', 'INT(11)', FALSE, self::AUTO_INCREMENT);
$this->setPK('id');
}
}
示例4: base_path
<?php
require base_path() . "/library/uploadimg.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$db = new database();
$option_im = array("table" => "products", "fields" => "image", "condition" => "id='{$_POST['id']}'");
$query_im = $db->select($option_im);
$rs_im = $db->get($query_im);
if (checkimg() == TRUE) {
$filename = date('YmdHis') . rand(0, 9);
$type = end(explode(".", $_FILES["image"]["name"]));
$image = $filename . "." . $type;
$path = base_path() . "/upload/product/";
uploadimg($filename, 600, 600, $path);
uploadimg("thumb_" . $filename, 400, 400, $path);
uploadimg("md_" . $filename, 150, 150, $path);
uploadimg("sm_" . $filename, 70, 70, $path);
if ($rs_im['image'] != "ecimage.jpg") {
@unlink($path . $rs_im['image']);
@unlink($path . "thumb_" . $rs_im['image']);
@unlink($path . "md_" . $rs_im['image']);
@unlink($path . "sm_" . $rs_im['image']);
}
} else {
$image = $rs_im['image'];
}
$value_pd = array("name" => trim($_POST['name']), "price" => trim($_POST['price']), "brandname" => trim($_POST['brandname']), "detail" => trim($_POST['detail']), "image" => $image, "product_categorie_id" => trim($_POST['product_categorie_id']));
$query_pd = $db->update("products", $value_pd, "id='{$_POST['id']}'");
if ($query_pd == TRUE) {
header("location:" . $baseUrl . "/back/product");
}
示例5: unset
<?php
/*
* php code///////////**********************************************************
*/
if (isset($_SESSION[_ss . 'msg_result'])) {
$msg_result = $_SESSION[_ss . 'msg_result'];
unset($_SESSION[_ss . 'msg_result']);
} else {
$msg_result = false;
}
$db = new database();
$option_user = array("table" => "users", "condition" => "id='1'");
$query_user = $db->select($option_user);
$rs_user = $db->get($query_user);
$title = 'เปลี่ยนรหัสผ่าน : ' . $rs_user['username'];
/*
* php code///////////**********************************************************
*/
/*
* header***********************************************************************
*/
require 'template/back/header.php';
/*
* header***********************************************************************
*/
?>
<script type="text/javascript" src="<?php
echo $baseUrl;
?>
/js/jquery.form-validator.min.js"></script>
示例6: database
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$db = new database();
$option_uw = array("table" => "users", "fields" => "password", "condition" => "id='{$_POST['id']}'");
$query_uw = $db->select($option_uw);
$rs_uw = $db->get($query_uw);
if ($rs_uw['password'] == trim(salt_pass($_POST['oldpassword']))) {
$value_pw = array("password" => trim(salt_pass($_POST['pass'])));
$query_pw = $db->update("users", $value_pw, "id='{$_POST['id']}'");
if ($query_pw == TRUE) {
header("location:" . $baseUrl . "/back/user");
}
} else {
$_SESSION[_ss . 'msg_result'] = TRUE;
header("location:" . $baseUrl . "/back/user/changepassword");
}
mysql_close();
}
示例7: database
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$db = new database();
$password = salt_pass($_POST['password']);
$option_pw = array("table" => "users", "fields" => "id,username,user_type", "condition" => "username='{$_POST['username']}' AND password='{$password}'");
$query_pw = $db->select($option_pw);
$rows_pw = $db->rows($query_pw);
if (1) {
$rs_pw = $db->get($query_pw);
$_SESSION[_ss . 'username'] = 'admin';
$_SESSION[_ss . 'id'] = '1234';
$_SESSION[_ss . 'levelaccess'] = 'admin';
header('location:' . $baseUrl . '/back/home/index');
} else {
header('location:' . $baseUrl . '/back/user/login');
}
mysql_close();
}
示例8: database
<?php
/*
* php code///////////**********************************************************
*/
$db = new database();
$option_pc = array("table" => "product_categories", "condition" => "id='{$_GET['id']}' ");
$query_pc = $db->select($option_pc);
$rs_pc = $db->get($query_pc);
$title = 'แก้ไขหมวดหมู่สินค้า : ' . $rs_pc['name'];
/*
* php code///////////**********************************************************
*/
/*
* header***********************************************************************
*/
require 'template/back/header.php';
/*
* header***********************************************************************
*/
?>
<script type="text/javascript" src="<?php
echo $baseUrl;
?>
/js/jquery.form-validator.min.js"></script>
<div id="page-warpper">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">แก้ไขข้อมูล <?php
echo $rs_pc['name'];
?>
示例9: get_database
/**
* Helper function to update into database
*/
protected static function get_database()
{
$class = get_called_class();
return database::get($class::$database);
}
示例10: update
private static function update($user_id, $key, $value)
{
$conn = database::get('dating');
database::queryf($conn, 'UPDATE user_profiles SET value = %s, date_updated = UNIX_TIMESTAMP() WHERE user_id = %d AND attribute = %s', $value, $user_id, $key);
return true;
}
示例11:
</div>
<div class="col-lg-6">
<table class="table" style="font-size: 12px;">
<thead>
<tr>
<th>#</th>
<th>ชื่อสินค้า</th>
<th style="text-align: right;">ราคา(บาท)</th>
<th style="text-align: right;">จำนวน</th>
<th style="text-align: right;">รวม</th>
</tr>
</thead>
<tbody>
<?php
$grand_total = 0;
while ($rs_od = $db->get($query_od)) {
$total_price = $rs_od['price'] * $rs_od['quantity'];
$grand_total = $total_price + $grand_total;
?>
<tr>
<td>
<img src="<?php
echo base_url();
?>
/upload/product/sm_<?php
echo $rs_od['image'];
?>
">
</td>
<td><?php
echo $rs_od['name'];
示例12:
?>
">รหัส</a>
</th>
<th id="user-grid_c4">
<a class="sort-link" href="<?php
echo $uri;
?>
">สร้าง</a>
</th>
<th class="button-column" id="user-grid_c6"> </th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
while ($rs_pc = $db->get($query_pc_page)) {
$tr = $i % 2 == 0 ? "odd" : "even";
?>
<tr class="<?php
echo $tr;
?>
">
<td>
<a class="load_data" href="<?php
echo $baseUrl;
?>
/back/productcategorie/update/<?php
echo $rs_pc['id'];
?>
"><?php
echo $rs_pc['name'];
示例13:
echo $uri;
?>
">หมวดหมู่</a>
</th><th id="user-grid_c4">
<a class="sort-link" href="<?php
echo $uri;
?>
">สร้าง</a>
</th>
<th class="button-column" id="user-grid_c6"> </th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
while ($rs_pd = $db->get($query_pd_page)) {
$tr = $i % 2 == 0 ? "odd" : "even";
?>
<tr class="<?php
echo $tr;
?>
">
<td>
<a class="load_data" href="<?php
echo $baseUrl;
?>
/back/product/update/<?php
echo $rs_pd['id'];
?>
"><?php
echo $rs_pd['pname'];
示例14: unset
<?php
/*
* php code///////////**********************************************************
*/
if (isset($_SESSION[_ss . 'msg_result'])) {
$msg_result = $_SESSION[_ss . 'msg_result'];
unset($_SESSION[_ss . 'msg_result']);
} else {
$msg_result = false;
}
$db = new database();
$option_py = array("table" => "contents", "condition" => "codename='howtopay' ");
$query_py = $db->select($option_py);
$rs_py = $db->get($query_py);
$title = 'วิธีการสั่งซื้อสินค้า';
/*
* php code///////////**********************************************************
*/
/*
* header***********************************************************************
*/
require 'template/back/header.php';
/*
* header***********************************************************************
*/
?>
<script type="text/javascript" src="<?php
echo $baseUrl;
?>
/ckeditor/ckeditor.js"></script>
示例15: cmd_rssex
static function cmd_rssex($name, $arg)
{
if (!$arg) {
$arg = database::get($_GET['from'], 'rssex', 'kanal');
if (!$arg) {
GGapi::putText('Podaj pełny adres kanału (z http://) lub ustaw domyślny funkcją ');
GGapi::putRichText('kanal2', TRUE);
GGapi::putRichText('!' . "\n\n");
GGapi::putRichText('Przykład:', FALSE, FALSE, TRUE);
GGapi::putRichText("\n" . 'rss2 http://wiadomosci.onet.pl/2,kategoria.rss');
return FALSE;
}
}
$rss = self::testurl($arg);
if (is_array($rss)) {
GGapi::putText('Nie udało się pobrać wybranego kanału RSS. Błąd: ' . $rss[1]);
return FALSE;
} elseif (!is_object($rss)) {
GGapi::putText('Wystąpił nieznany błąd przy pobieraniu danych. Przepraszamy.');
}
GGapi::putRichText(self::p($rss->channel->title), TRUE);
if ($rss->channel->copyright) {
GGapi::putRichText("\n" . self::p($rss->channel->copyright));
}
foreach ($rss->channel->item as $item) {
GGapi::putRichText("\n\n" . self::p($item->title), TRUE);
GGapi::putRichText("\n" . self::p($item->description, $arg == 'bash') . "\n" . self::p($item->link));
if (GGapi::getLength() > 1700) {
return;
}
}
}