phpers 发表于 2010-6-16 17:37:35

在线等。。。购物车类问题。。。

function add_cart() {
                $id = $this->input->post ( 'id' );//产品id
                $qty = $this->input->post ( 'qty' );//数量
                $price = $this->input->post ( 'price' );//价格
                $name = $this->input->post ( 'name' );//产品名字
          $size= $this->input->post('size');
                $data = array (
               'id' => $id,
               'qty' => $qty,
               'price' => $price,
               'name' => $name,
               'optiions' => array('size' => $price)
               );
                $this->cart->insert($data);
                redirect ( 'search/flow' );
       
        }

为什么数据库是空的

phpers 发表于 2010-6-16 19:24:32

只有人看 没有人回答

上善若水 发表于 2010-6-17 20:38:23

你没有插入到数据库啊,这个操作只是插入到了 sessions里

上善若水 发表于 2010-6-17 20:42:51

本帖最后由 上善若水 于 2010-6-17 20:44 编辑

function add_cart()
{
    $data = array (
          'id' => $this->input->post ( 'id' ),
          'qty' => $this->input->post ( 'qty' ),
          'price' => $this->input->post ( 'price' ),
          'name' => $this->input->post ( 'name' ),
          'optiions' => array('size' => $this->input->post('size'))
          );
   $this->cart->insert($data);
    redirect ( 'search/flow' );
}

这样是否会更好一点

visvoy 发表于 2010-6-17 20:54:41

'optiions'
你确定是两个i?

上善若水 发表于 2010-6-18 11:30:53

:shutup: 版主眼真尖

phpers 发表于 2010-6-21 12:53:50

问题已经解决 谢谢大家支持

oraclelee 发表于 2011-12-20 11:00:17

PS:请问如何调试查看购物车里的数据。是否是只要cart->insert($data);之后就不用insert数据库了呢?
页: [1]
查看完整版本: 在线等。。。购物车类问题。。。