Problem with adding database records using THINKPHP3?
冥冥中有主宰
冥冥中有主宰 2018-12-25 15:55:11
0
0
1206

if ($cart_info) {

$data['num'] = intval($cart_info['num']) intval($num);

//Judge inventory

if (intval($check_info['num'])<=$data['num']) {

echo json_encode(array('status'=>0,'err '=>'Out of stock!'));

exit;

}

$res = $shpp->where('id='.intval( $cart_info['id']))->save($data);

}else{

$data['pid']=intval($pid);

$data['num']=intval($num);

$data['addtime']=time();

$data['uid']=intval ($uid);

$data['shop_id']=intval($check_info['shop_id']);

$ptype = 1;

if (intval ($check_info['pro_type'])) {

$ptype = intval($check_info['pro_type']);

}

$data['type' ]=$ptype;

$data['price'] = $check_info['price_yh'];

            $data['aa']='Add'

$res=$shpp->add($data);

}


## if($res){

echo json_encode (array('status'=>1,'cart_id'=>$res)); //This product has been successfully added to your shopping cart

exit;

}else{

echo json_encode(array('status'=>0,'err'=>'Join failed.'));

exit;

}




##$res=$shpp->add($data); Return after adding the record ID=1

But my database ID value is 5,

The ID of the database is not synchronized with the newly added records.

冥冥中有主宰
冥冥中有主宰

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template