#1 改变命运2023
无论我是通过findsql 还是find条件语句,查出来的结果都是数组,这样,我想将些数据插入到数据库中就出了问题。以下是我的代码:$id=$user->findsql("select id from user where username='".$username."'and pwd='".$passwd."'");
$_SESSION['id']=$id;
dump($id);exit;
这是读出来的效果。
Array( [0] => Array ( [id] => 4 ))而我想在另一个地方想将$_SESSION['id'],插入到数据库中,就出现了无法插入的问题。
$cart = spClass("cart");
$postres = $this->spArgs("id");
$condition = array('pro_id'=>$postres);
$count=$this->spArgs("count");
$price=$this->spArgs("price");
$newrow = array('count'=>$count,
'session_id'=>$_SESSION['id'],
'name'=>$this->spArgs("name"),
'price'=>$price,
'pro_id'=>$this->spArgs("id"),
'countprice'=>$price*$count,
'c_number'=>date("YmdHis"),
);
$c=$cart->create($newrow);
请jake帮忙,谢谢
2012-04-27 11:56:42