Use PHP to add shopping items, and add shopping items in PHP _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Tags php online
Use PHP to add shopping items and PHP to add shopping items. Use PHP to add shopping items, and use PHP to add shopping items 1? Php2session_start (); 3 header (Content-type: texthtml; charsetUTF-8); set file encoding format 4 require (systems add shopping items with PHP, PHP add shopping items
1
 ExecSQL ($ sqls, $ conn); 23 if (! Empty ($ shopcont [0] ['shopping']) {// shopping is a three-dimensional array. use empty to determine whether the product is empty 24 $ arr = explode ('@', $ shopcont [0] ['shopping']); // @ splits the array, that is, 25 foreach ($ arr as $ value) for each item) {// foreach retrieves the value of each array 26 $ arrtmp = explode (',', $ value ); // use explode to separate the commodity's inherent information 27 if ($ key = $ arrtmp [0]) {// if the added item is equal to the added item 28 $ reback = '3'; // the returned value indicates that 29 $ boo = true; 30 break has been added; 31} 32} 33 if ($ boo = false) {// method 1 add product 34 $ shopcont [0] ['shopping']. = '@'. $ Key. ', 1'; 35 $ update = "update tb_user set shopping = '". $ shopcont [0] ['shopping']. "'Where name = '". $ _ SESSION ['member']. "'"; 36 $ shop = $ admindb-> ExecSQL ($ update, $ conn); 37 if ($ shop) {38 $ reback = 1; 39} else {40 $ reback = '4'; 41} 42} 43} else {44 $ arrtmp = $ key. ", 1"; // method 2 add product 45 $ updates = "update tb_user set shopping = '". $ arrtmp. "'Where name = '". $ _ SESSION ['member']. "'"; 46 $ result = $ admindb-> ExecSQL ($ Updates, $ conn); 47 if ($ result) {48 $ reback = 1; 49} else {50 $ reback = '4 '; 51} 52} 53} 54} 55 echo $ reback; 56?>

How does a PHP shopping website add products in the background and display them in the foreground?

You can use the PHP online shop program or write it yourself!

If you use online shop programs, you can take a closer look at the background instructions. It is actually very simple.

If you have the ability to write, you can write it yourself, EASY.

How to prevent the browser from refreshing the number of items in the shopping cart by automatically adding 1, php shopping website

This is the case when Ajax is used for asynchronous submission... Addtocart ();

Limit 1? Php 2 session_start (); 3 header ("Content-type: text/html; charset = UTF-8"); // Set file encoding format 4 require ("system/s...

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.