Cash cart with session

Source: Internet
Author: User
Use session to implement shopping cart and use session to implement shopping cart. I want to insert the information of a commodity into the $ arr array as an array, and the last array is a two-dimensional array, store all the purchased information, so if the product has been purchased, how can I determine and only increase its pdnum by 1 without inserting a new item? this code group uses session to implement the shopping cart.
Use session to implement the shopping cart. I want to insert the information of a commodity into the $ arr array as an array if I click to add it to the shopping cart,
Finally, this array is a two-dimensional array that stores all purchased information,
So if the product has already been purchased, how can I determine and just increase its pdnum by 1 without inserting a new item,
This code cannot be organized. who can help ..
$ Arr = array ("pdname" => "xx", "pdprice" => 12, "pdnum" => 1 ), array ("pdname" => "yy", "pdprice" => 22, "pdnum" => 1 ))
?>
------ Solution --------------------
Why do we need a two-dimensional array?
Isn't it easier to use a one-dimensional model?
Commodity name (or commodity) => quantity

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.