在线等。。。购物车类问题。。。
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' );
}
为什么数据库是空的 只有人看 没有人回答 你没有插入到数据库啊,这个操作只是插入到了 sessions里 本帖最后由 上善若水 于 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' );
}
这样是否会更好一点 'optiions'
你确定是两个i? :shutup: 版主眼真尖 问题已经解决 谢谢大家支持 PS:请问如何调试查看购物车里的数据。是否是只要cart->insert($data);之后就不用insert数据库了呢?
页:
[1]