用户
 找回密码
 入住 CI 中国社区
搜索
查看: 2965|回复: 7
收起左侧

[已解决] 在线等。。。购物车类问题。。。

[复制链接]
发表于 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' );
       
        }

为什么数据库是空的
 楼主| 发表于 2010-6-16 19:24:32 | 显示全部楼层
只有人看 没有人回答
发表于 2010-6-17 20:38:23 | 显示全部楼层
你没有插入到数据库啊,这个操作只是插入到了 sessions里
发表于 2010-6-17 20:42:51 | 显示全部楼层
本帖最后由 上善若水 于 2010-6-17 20:44 编辑
PHP复制代码
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' );
}
复制代码


这样是否会更好一点
发表于 2010-6-17 20:54:41 | 显示全部楼层
'optiions'
你确定是两个i?
发表于 2010-6-18 11:30:53 | 显示全部楼层
 版主眼真尖
 楼主| 发表于 2010-6-21 12:53:50 | 显示全部楼层
问题已经解决 谢谢大家支持
发表于 2011-12-20 11:00:17 | 显示全部楼层
PS:请问如何调试查看购物车里的数据。是否是只要cart->insert($data);之后就不用insert数据库了呢?

本版积分规则