To ask a question about

Source: Internet
Author: User
To ask a question
I'm making a shopping cart.
Shopping Cart Page cart.php

Define (' Accese ', 1);
Require ('.. /init.php ');

$_get[' gid '] = (int) $_get[' gid ');
$_get[' num '] = (int) $_get[' num '];

$goods = new Goodsmodel ();
$goods->db ();
$cart = Cart::getcart ();

Switch ($_get[' act ']) {
Add Item
Case ' buy ': {
$result = $goods->select_goods ("g_id = $_get[gid] and g_sale=1 and g_del=0");
$g = $goods->db->fetch_array ($result);
Have this product
if (!empty ($g)) {//Determine if the product exists
if ($g [' G_no '] < $_get[' num ') {//Determine inventory
$type = ' ERROR ';
$msg = ' Put to cart add failed (may be out of stock or admin pocketed) ';
Include (ROOT. ' view/home/tip.html ');
Exit
}
Commodity presence
$cart->additem ("$g [g_id]", "$g [G_name]", "$g [G_price]", "$_get[num]"); ----------------------This line error
} else {
$type = ' ERROR ';
$msg = ' Put to cart add failed (may be down, deleted or admin pocketed) ';
Include (ROOT. ' view/home/tip.html ');
Exit
}
Break
}

}

$title = ' Shopping cart-mall system ';
$path = ' shopping cart ';
Include (ROOT. ' view/home/cart.html ');
  • 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.