本文整理匯總了PHP中truncate_table函數的典型用法代碼示例。如果您正苦於以下問題:PHP truncate_table函數的具體用法?PHP truncate_table怎麽用?PHP truncate_table使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了truncate_table函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: process_order
/**
* 訂單
*/
function process_order()
{
global $db, $ecs;
/* 清空訂單、訂單商品 */
truncate_table('order_info');
truncate_table('order_goods');
truncate_table('order_action');
/* 訂單 */
$sql = "SELECT o.* FROM " . $this->sprefix . "orders AS o ";
$res = $this->sdb->query($sql);
while ($row = $this->sdb->fetchRow($res)) {
$order = array();
$order['order_sn'] = $row['order_id'];
$order['user_id'] = $row['member_id'];
$order['add_time'] = $row['createtime'];
$order['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['consignee']));
$order['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['ship_addr']));
$order['zipcode'] = $row['ship_zip'];
$order['tel'] = $row['ship_tel'];
$order['mobile'] = $row['ship_mobile'];
$order['email'] = $row['ship_email'];
$order['postscript'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo']));
$order['shipping_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['ship_name']));
$order['pay_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['shipping']));
$order['inv_payee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['tax_company']));
$order['goods_amount'] = $row['total_amount'];
$order['shipping_fee'] = $row['cost_freight'];
$order['order_amount'] = $row['final_amount'];
$order['pay_time'] = $row['paytime'];
$order['shipping_time'] = $row['acttime'];
/* 狀態 */
if ($row['ordstate'] == '0') {
$order['order_status'] = OS_UNCONFIRMED;
$order['shipping_status'] = SS_UNSHIPPED;
} elseif ($row['ordstate'] == '1') {
$order['order_status'] = OS_CONFIRMED;
$order['shipping_status'] = SS_UNSHIPPED;
} elseif ($row['ordstate'] == '9') {
$order['order_status'] = OS_INVALID;
$order['shipping_status'] = SS_UNSHIPPED;
} else {
$order['order_status'] = OS_CONFIRMED;
$order['shipping_status'] = SS_SHIPPED;
}
if ($row['pay_status'] == '1') {
$order['pay_status'] = PS_PAYED;
} else {
$order['pay_status'] = PS_UNPAYED;
}
if ($row['userrecsts'] == '1') {
if ($row['recsts'] == '1') {
if ($order['shipping_status'] == SS_SHIPPED) {
$order['shipping_status'] = SS_RECEIVED;
}
} elseif ($row['recsts'] == '2') {
$order['order_status'] = OS_CANCELED;
$order['pay_status'] = PS_UNPAYED;
$order['shipping_status'] = SS_UNSHIPPED;
}
}
if (!$db->autoExecute($ecs->table('order_info'), $order, 'INSERT', '', 'SILENT')) {
//return $db->error();
}
/* 訂單商品 */
}
/* 返回 */
return TRUE;
}
示例2: process_order
/**
* 訂單
*/
function process_order()
{
global $db, $ecs;
/* 清空訂單、訂單商品 */
truncate_table('order_info');
truncate_table('order_goods');
truncate_table('order_action');
/* 訂單 */
$sql = "SELECT o.*, t.tmethod, p.payment FROM ".$this->sprefix."mall_orders AS o " .
"LEFT JOIN ".$this->sprefix."mall_offer_t AS t ON o.ttype = t.id " .
"LEFT JOIN ".$this->sprefix."mall_offer_p AS p ON o.ptype = p.id";
$res = $this->sdb->query($sql);
while ($row = $this->sdb->fetchRow($res))
{
$order = array();
$order['order_sn'] = $row['orderid'];
$order['user_id'] = $row['userid'];
$order['add_time'] = $row['ordertime'];
$order['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name']));
$order['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['addr']));
$order['zipcode'] = $row['zip'];
$order['tel'] = $row['tel'];
$order['mobile'] = $row['mobile'];
$order['email'] = $row['email'];
$order['postscript'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo']));
$order['shipping_name'] = is_null($row['tmethod']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['tmethod']));
$order['pay_name'] = is_null($row['payment']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['payment']));
$order['inv_payee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['invoiceform']));
$order['goods_amount'] = $row['item_amount'];
$order['shipping_fee'] = $row['freight'];
$order['order_amount'] = $row['total_amount'];
$order['pay_time'] = $row['paytime'];
$order['shipping_time'] = $row['sendtime'];
/* 狀態 */
if ($row['ordstate'] == '0')
{
$order['order_status'] = OS_UNCONFIRMED;
$order['shipping_status'] = SS_UNSHIPPED;
}
elseif ($row['ordstate'] == '1')
{
$order['order_status'] = OS_CONFIRMED;
$order['shipping_status'] = SS_UNSHIPPED;
}
elseif ($row['ordstate'] == '9')
{
$order['order_status'] = OS_INVALID;
$order['shipping_status'] = SS_UNSHIPPED;
}
else // 3 發貨 4 歸檔
{
$order['order_status'] = OS_CONFIRMED;
$order['shipping_status'] = SS_SHIPPED;
}
if ($row['ifsk'] == '1')
{
$order['pay_status'] = PS_PAYED;
}
else // 0 未付款 5 退款
{
$order['pay_status'] = PS_UNPAYED;
}
if ($row['userrecsts'] == '1') // 用戶操作了
{
if ($row['recsts'] == '1') // 到貨
{
if ($order['shipping_status'] == SS_SHIPPED)
{
$order['shipping_status'] = SS_RECEIVED;
}
}
elseif ($row['recsts'] == '2') // 取消
{
$order['order_status'] = OS_CANCELED;
$order['pay_status'] = PS_UNPAYED;
$order['shipping_status'] = SS_UNSHIPPED;
}
}
/* 如果已付款,修改已付款金額為訂單總金額,修改訂單總金額為0 */
if ($order['pay_status'] > PS_UNPAYED)
{
$order['money_paid'] = $order['order_amount'];
$order['order_amount'] = 0;
}
if (!$db->autoExecute($ecs->table('order_info'), $order, 'INSERT', '', 'SILENT'))
{
//return $db->error();
}
/* 訂單商品 */
//.........這裏部分代碼省略.........