本文整理汇总了PHP中order函数的典型用法代码示例。如果您正苦于以下问题:PHP order函数的具体用法?PHP order怎么用?PHP order使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了order函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DoList
function DoList()
{
$keyword = trim($this->Get['keyword']);
$where_list = array();
if ($keyword) {
$where_list[] = "`name` like '%{$keyword}%'";
}
$where = "";
$where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' ';
$per_page_num = (int) $this->Get['pn'] ? (int) $this->Get['pn'] : 50;
$offset = (max((int) $this->Get['page'], 1) - 1) * $per_page_num;
$sql = "SELECT count(1) total from " . TABLE_PREFIX . "tag {$where}";
$query = $this->DatabaseHandler->Query($sql);
$row = $query->GetRow();
$total = $row['total'];
$order_by_list = array('order_by_default' => 'default', 'default' => array('name' => '添加时间', 'order_by' => 'id'), 'thread_count' => array('name' => '使用次数', 'order_by' => 'total_count'), 'member_count' => array('name' => '标签名称', 'order_by' => 'name'));
$order_condition = order($order_by_list, "admin.php?mod=tag&keyword=" . urlencode($keyword), array('display_un_href' => true));
$sql = "SELECT *\r\n\t\tFROM " . TABLE_PREFIX . "tag\r\n\t\t{$where}\r\n\t\t{$order_condition['order']}\r\n\t\tlimit {$offset},{$per_page_num}";
$query = $this->DatabaseHandler->Query($sql);
$tag_list = array();
while ($row = $query->GetRow()) {
$row['dateline'] = my_date_format($row['dateline']);
$row['tag_html'] = $this->_tag_html($row['id'], $row['status']);
$tag_list[] = $row;
}
$pages = page($total, $per_page_num, '', array(), "20 50 100 200 300");
$tag_item_list = jconf::get('tag', 'item_list');
$tag_num = jconf::get('tag_num');
foreach ($tag_item_list as $key => $val) {
$val["selected_" . (int) $tag_num[$val['value']]] = " selected ";
$tag_item_list[$key] = $val;
}
include template('admin/tag');
}
示例2: area
public function area()
{
$map = array('region_type' => 1);
$list = M('region')->where($map)->select();
$list = order($list);
$this->assign('list', $list);
$this->display();
}
示例3: flat_load
/**
* Load entity
*
* @param array $entity
* @param array $crit
* @param array $opts
*
* @return array
*/
function flat_load(array $entity, array $crit = [], array $opts = []) : array
{
$stmt = db()->prepare(select($entity['attr']) . from($entity['tab']) . where($crit, $entity['attr'], $opts) . order($opts['order'] ?? [], $entity['attr']) . limit($opts['limit'] ?? 0, $opts['offset'] ?? 0));
$stmt->execute();
if (!empty($opts['one'])) {
return $stmt->fetch() ?: [];
}
return $stmt->fetchAll();
}
示例4: index
public function index()
{
header("content-type:text/html;charset=utf-8");
import("@.ORG.Page");
$db = M('goods_category');
/*$count = $db->count();
$Page = new Page($count,10);
$list = $db->order('id DESC')->limit($Page->firstRow.','.$Page->listRows)->select();
$show = $Page->show();*/
$_list = $db->order('list asc')->select();
$list = order($_list);
$this->assign('show', $show);
$this->assign('list', $list);
$this->display();
}
示例5: die
die(JSON::encode($return_data));
}
$user_id = $_SESSION['user_id'];
$method = $_SERVER['REQUEST_METHOD'];
$resource = isset($_REQUEST['api_data']) ? trim($_REQUEST['api_data']) : 'hot';
/* 根据不同的API_RESOURCE来做不同的处理 */
switch ($resource) {
case 'hot':
include_once 'includes/controller/goods/lib_controller_list.php';
api_return($resource, li_st());
break;
case 'view':
include_once 'includes/controller/goods/lib_controller_view.php';
api_return($resource, view());
break;
case 'idcard':
include_once 'includes/controller/goods/lib_controller_new.php';
api_return($resource, idcard());
break;
case 'secret':
include_once 'includes/controller/goods/lib_controller_secret.php';
api_return($resource, secret());
break;
case 'order':
include_once 'includes/controller/goods/lib_controller_order.php';
api_return($resource, order());
break;
default:
# code...
break;
}
示例6: define
include "shop/db.php";
include "shop/lib.php";
define('BASKET', "{$_COOKIE['basket']}");
if (isset($_GET[id])) {
$id = $_GET[id];
delItem('orders', $id);
header("Location: basket.php");
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
$itemname = clrStr($_POST[itemname]);
$itemprice = clrInt($_POST[itemprice]);
$quantity = clrInt($_POST[cost]);
$img = clrStr($_POST[image]);
if ($quantity > 0) {
order(BASKET, $itemname, $itemprice, $img, $quantity);
} else {
header("Refresh:3; url=../index.php#price");
echo "<h2> Неверное количество Товаров!</h2>";
}
}
$q = qtItem(BASKET);
if ($q > 0) {
echo "<h2>У Вас в корзине {$q} товаров!</h2>";
addOrder();
} else {
echo "<h2>Ваша корзина пуста!</h2>";
}
?>
<DOCTYPE html>
<html>
示例7: multiple
" />
<br/><br/><br/> <button type="submit" class="btn btn-primary">Додати</button>
</div>
</div>
</form>
<?php
}
?>
<?php
if ($e == 'many') {
multiple($e, $t, $t_id);
} elseif ($e == 'one') {
single($e, $t, $t_id);
} elseif ($e == 'yn') {
yn($e, 2, $t_id);
} elseif ($e == 'text') {
text($e, $t_id);
} elseif ($e == 'order') {
order($e, $t, $t_id);
}
?>
<div class="col-xs-9 col-sm-8 col-md-6 col-lg-4 col-xs-offset-3 col-sm-offset-2 col-md-offset-2 col-lg-offset-2">
<a href="<?php
print URL;
?>
?c=manageTests&f=create_question_hand">назад</a>
</div>
</div></div></div>
</div>
</div>
示例8: order
" />
</label></td>
</tr>
<tr>
<td class="height_row"><div align="right">Nick Skype </div></td>
<td class="height_row"><input name="skype" type="text" class="input_text" id="skype" value="<?php
echo $row['skype'];
?>
" /></td>
</tr>
<tr>
<td class="height_row"><div align="right">Số TT</div></td>
<td class="height_row">
<select name="order" class="input_text" >
<?php
order(1, 21, $row['stt']);
?>
</select> </td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="UpdateUsers" value="Sửa thành viên" <?php
echo @$_SESSION['modmana'] == '2' ? 'disabled' : '';
?>
/>
<input type="reset" name="Submit2" value="Nhập Lại" <?php
echo @$_SESSION['modmana'] == '2' ? 'disabled' : '';
?>
/>
</label></td>
示例9: orderup
/**
* Moves the record down one position
*/
function orderup()
{
order(1);
}
示例10: order
<tr>
<td class="height_row"><div align="right">Picture </div></td>
<td class="height_row"><label>
<input name="picture_hidden" type="hidden" value="<?php
echo $row['picture'];
?>
" />
<input name="picture" type="file" id="picture" />
</label></td>
</tr>
<tr>
<td class="height_row"><div align="right">Số thứ tự </div></td>
<td class="height_row">
<select name="order" class="input_text" >
<?php
order(1, 11, $row['stt']);
?>
</select></td>
</tr>
<tr>
<td class="height_row"><div align="right">Vị trí </div></td>
<td class="height_row">
<select name="alignment" class="input_text" >
<option value="1" <?php
echo $row['alignment'] == '1' ? 'Selected' : '';
?>
>Bên trái</option>
<option value="2" <?php
echo $row['alignment'] == '2' ? 'Selected' : '';
?>
>Bên phải</option>
示例11: write
function write($_POST)
{
$Out = "";
#get & send vars
foreach ($_POST as $key => $value) {
${$key} = $value;
$Out .= "<input type='hidden' name=\${$key} value='{$value}'>";
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 100, "Invalid stock item id.");
if (isset($me)) {
$v->isOk($me, "string", 0, 100, "Invalid bar code.");
}
$v->isOk($sharecode, "string", 0, 100, "Invalid shared bar code.");
# display errors, if any
if ($v->isError()) {
return order($_POST, $v->genErrors());
}
$cols = grp(m("bar", $sharecode));
$wh = "stkid='{$id}'";
$qry = new dbUpdate("stock", "cubit", $cols, $wh);
$qry->run(DB_UPDATE);
if (isset($me) && strlen($me) > 0) {
db_conn("cubit");
switch (substr($me, strlen($me) - 1, 1)) {
case "0":
$tab = "ss0";
break;
case "1":
$tab = "ss1";
break;
case "2":
$tab = "ss2";
break;
case "3":
$tab = "ss3";
break;
case "4":
$tab = "ss4";
break;
case "5":
$tab = "ss5";
break;
case "6":
$tab = "ss6";
break;
case "7":
$tab = "ss7";
break;
case "8":
$tab = "ss8";
break;
case "9":
$tab = "ss9";
break;
default:
return order($_POST, "The code you selected is invalid");
}
if (barext_ex($tab, 'code', $me) or strlen($me) == 0) {
return order($_POST, "The code you selected aready exits in the system.");
} else {
$getcheck = "SELECT * FROM " . $tab . " WHERE code = '{$me}' AND active = 'no'";
$runcheck = db_exec($getcheck) or errDie("Unable to get serial number check");
if (pg_numrows($runcheck) < 1) {
$Sl = "INSERT INTO " . $tab . " (code,stock,div) VALUES ('{$me}','{$id}','" . USER_DIV . "')";
$Rs = db_exec($Sl) or errDie("Unable to update database.", SELF);
} else {
$arr = pg_fetch_array($runcheck);
$Sl = "UPDATE " . $tab . " SET active = 'yes' WHERE code = '{$arr['code']}' AND stock = '{$arr['stock']}' AND div = '{$arr['div']}'";
$Rs = db_exec($Sl) or errDie("Unable to update database.", SELF);
}
}
}
return order($_POST);
}
示例12: testApiTypeHints
public function testApiTypeHints()
{
function order(Topping $topping)
{
if ($topping == Topping::BLACKBERRY()) {
return 'Unfortunately, we are all out of ' . $topping->getValue() . ' topping!';
}
return 'Here you go, an icecream with ' . $topping->getValue() . ' topping!';
}
// Attempt to order an icecream with different toppings
$icecream = order(Topping::STRAWBERRY());
$blackberry = order(Topping::BLACKBERRY());
try {
order('test');
// Error, 'test' is no Topping instance
} catch (Exception $e) {
$error = $e->getMessage();
}
$this->assertInternalType('string', $icecream);
$this->assertInternalType('string', $blackberry);
print sprintf('%s.', $icecream) . PHP_EOL;
print sprintf('%s.', $blackberry) . PHP_EOL;
print sprintf('%s.', $error) . PHP_EOL;
}
示例13: order
echo $require;
?>
Tên menu: </div></td>
<td width="600">
<input type="text" name="title" id="inputRegister" value="<?php
echo $row['title'];
?>
" size="30"> </td>
</tr>
<tr>
<td class="height_row"><div align="right">Số TT</div></td>
<td colspan="3" class="height_row">
<select name="stt" >
<?php
order(1, 100, $row['stt']);
?>
</select> </td>
</tr>
<tr>
<td class="height_row"><div align="right">Nội dung</div></td>
<td class="height_row">
<?php
$oFCKeditor = new FCKeditor('full');
$oFCKeditor->BasePath = 'fckeditor/';
$oFCKeditor->Value = $row['full'];
$oFCKeditor->Create();
?>
示例14: write
function write($_POST)
{
$Out = "";
#get & send vars
foreach ($_POST as $key => $value) {
${$key} = $value;
$Out .= "<input type=hidden name=\${$key} value='{$value}'>";
}
# validate input
require_lib("validate");
$v = new validate();
$v->isOk($id, "num", 1, 100, "Invalid bar code.");
$v->isOk($rid, "num", 1, 10, "Invalid stock code.");
$v->isOk($tab, "string", 3, 3, "Invalid stock code.");
# display errors, if any
if ($v->isError()) {
$errors = "";
$Errors = $v->getErrors();
foreach ($Errors as $e) {
$errors .= "<li class=err>" . $e["msg"];
}
$errors .= "<input type=hidden name=errors value='{$errors}'>";
return order($_POST, $errors);
}
db_conn("cubit");
$Sl = "DELETE FROM " . $tab . " WHERE code='{$id}'";
$Rs = db_exec($Sl) or errDie("Unable to update database.", SELF);
header("Location: pos.php?id={$rid}");
exit;
}
示例15: Main
function Main()
{
$this->CheckAdminPrivs('sessions');
$where_list=array();
$where="";
$query_link="admin.php?mod=sessions";
$p=max((int)$this->Get['page'],1);
$query_link.="&page=".$p;
$pn=(int)$this->Get['pn']?(int)$this->Get['pn']:20;
if($pn<1)$pn=20;
$query_link.='&pn='.$pn;
$username=trim($this->Get['username']);
if ($username!="")
{
$where_list[]="username like '%$username%'";
$query_link.="&username=".urlencode($username);
}
$ip=trim($this->Get['ip']);
if (!empty($ip))
{
$ip_l=explode('.',$ip);
$ips='';
$i=0;
foreach ($ip_l as $_ip)
{
$i++;
if($_ip=="*" || empty($_ip))continue;
$ips.=$and."ip{$i}='$_ip'";
$and=" and ";
}
$where_list[]=$ips;
}
if($this->Get['order_by'])$query_link.="&order_by=".$this->Get['order_by'];
if($this->Get['order_type'])$query_link.="&order_type=".$this->Get['order_type'];
if($where_list)$where=" where ".implode(" AND ",$where_list);
$order_by_list = array
(
'order_by_default' => 'lastactivity',
'lastactivity' => array
(
'name' => '最后访问时间',
'order_by' => 'lastactivity',
),
'ip' => array
(
'name' => 'IP地址',
'order_by' =>"concat_ws('.',ip1,ip2,ip3,ip4)",
),
'uid' => array
(
'name' => '用户名',
'order_by' => 'uid',
),
);
$order_array = order($order_by_list,$query_link,array('display_un_href'=>true));
$order = $order_array['order'];
$order_html = $order_array['html'];
$limit="";
$offset=($p-1)*$pn;
$sql="SELECT count(1) total from ".TABLE_PREFIX."system_sessions".$where;
$query = $this->DatabaseHandler->Query($sql);
$row=$query->GetRow();
$total=$row['total'];
$sql="SELECT * from ".TABLE_PREFIX."system_sessions".$where." ".$order." limit $offset,$pn";
$query = $this->DatabaseHandler->Query($sql);
$session_list=array();
while ($row=$query->GetRow())
{
$row['dateline']=my_date_format($row['lastactivity']);
$row['ip']=sprintf("%s.%s.%s.%s",$row['ip1'],$row['ip2'],$row['ip3'],$row['ip4']);
$session_list[]=$row;
}
$robot=array();
$robot_record=(int)ConfigHandler::get('robot','turnon');
if($robot_record==1)
{
$sql="SELECT * from ".TABLE_PREFIX."system_robot_ip";
$query=$this->DatabaseHandler->Query($sql,"SKIP_ERROR");
if($query)
{
while ($row=$query->GetRow())
{
$robot[$row['ip']]=$row['name'];
}
}
}
//.........这里部分代码省略.........