示例:
在这种情况下,优先级为customer1。
<?php
session_start();
include('includes/config.php');
$id2=$_SESSION['id'];
$name = $_POST['name'];
$branch = $_POST['branch'];
$transcode = $_POST['code'];
$q = mysql_query("select * from cart where mem_id=$id2 and transactioncode='$transcode'");
while($r = mysql_fetch_array($q)) {
$category_desc=$r['category_desc'];
$type=$r['type'];
$images=$r['images'];
$size=$r['size'];
$qty=$r['qty'];
$price=$r['price'];
$total=$r['total'];
$attach_files=$r['attach_files'];
$dt_claimingR=$r['dt_claimingR'];
$message=$r['message'];
mysql_query("INSERT INTO reservation (`mem_id`,`name`,`branch`,`category_desc`,`type`,`images`,`size`,`qty`,`price`,`total`,`attach_files`,`dt_claimingR`,`message`,`WR_status`, `status`,`transactioncode`)
VALUES('$id2','$name','$branch','$category_desc','$type','$images','$size','$qty','$price','$total','$attach_files','$dt_claimingR','$message','Priority(<?php echo $count; ?>)','pending...','$transcode')")
or die(mysql_error());
}
echo "success";
?>
<script>
window.location.href="layouting.php";
</script>
答案 0 :(得分:0)
假设datum是表格中的日期列,然后使用:
order by date asc/desc
e.g。
$q = mysql_query("select * from cart where mem_id=$id2 and
transactioncode='$transcode' order by datum desc");
关于优先级:你需要表单(Get | POST)假设优先级的请求参数是p,可能的值是:a表示asc,d表示desc:
<?php
$p = $_REQUEST['p'];
$priority = 'asc'; //default value
if($p == 'd') {
$priority = 'desc';
}
$q = mysql_query("select * from cart where mem_id=$id2 and
transactioncode='$transcode' order by datum {$priority}");