Jump to content

ozzles2006

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ozzles2006's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hmm, shouldn't it be [b]mysql_connect()[/b] ?
  2. Thought I should post the bit of code I'm dealing with. [quote]$cart=$_COOKIE['cart']; $item = $_POST['id']; $qty = $_POST['qty']; if (strlen($cart)==1) { setcookie('cart',''); echo "<meta content='0;url=index.php?p=checkout' http-equiv='refresh' />"; } else { $cart = explode("|", $_COOKIE['cart']); $cart_count = array_count_values($cart); foreach ($cart_count as $itemNum => $qty) { } echo "<meta content='0;url=index.php?p=checkout' http-equiv='refresh' />"; }[/quote] Basically what I'm doing is using the array_count_values method to "group by" the item number. So what I want to do is reduce the quantity for the item corresponding to the button that's been pressed and then regenerate the string and add it to the cookie again.
  3. I'm trying to build an e-commerce type website... I couldn't get a "shopping cart" array to store in a session variable, so I gave up and started on cookies instead. So.. I have a string that I'm getting from a cookie. It's in the format "1,2,1,3,4,5" and so on (no particular order) depending on what's been put into it. I'm just wondering if theres any way to delete, for example, 1 instance of "2," or "5"? I can do it to remove all entries, but I only want it to do it once.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.