• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP truncate_table函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;
 }
开发者ID:BGCX262,项目名称:zuyii-svn-to-git,代码行数:71,代码来源:shopex48.php


示例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();
            }

            /* 订单商品 */
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:mdwp,代码行数:101,代码来源:shopex47.php



注:本文中的truncate_table函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP truncate_text函数代码示例发布时间:2022-05-23
下一篇:
PHP truncate_string函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap