Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8544945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:40:55+00:00 2026-06-11T12:40:55+00:00

I have a cart which is basically just going to be for presentation on

  • 0

I have a cart which is basically just going to be for presentation on the side of a website, at the moment whenever you click buy on an item it adds the sku to the array of bought items, and then the cart pulls out the description, sku, price, and label for each item with that sku from a database of items. That all works fine, but I want to add a button next to each item that will delete the item on that line if the person chooses not to buy it. Here is my current code:

<?php
include 'connect.php';

mysql_select_db('test', $con);

$arr = array(
"1",
"12",
"123",
"1234",
"1234h",
"12345h",
);

echo "<h1>cart</h1><br />";
echo "bought items: <br />";
echo "<br />";
echo "(Description|(Sku)| - Price <br />";
echo "<br />";
$a_length = count($arr);
for($i=0;$i<$a_length;$i++){

$sku = $arr[$i];

$result = mysql_query("SELECT label,sku,description,price FROM cart_test WHERE sku = '$sku'");

if(!$result){
    echo 'could not run query: ' . mysql_error();
    exit;
}

$row = mysql_fetch_row($result);


echo "$row[0]: $row[2]($row[1]) - $$row[3]";
echo "<br />";
}


?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T12:40:56+00:00Added an answer on June 11, 2026 at 12:40 pm

    Did you try removing it from the array? You’re not inserting anything into the database, so it doesn’t care.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a shopping cart in a website and I have my items(which
I'm building an ASP.Net website. I have a cart class which stores the items
I have a very simple cart which displays the item quantity in a text_field,
I have a niche website which sells souvenirs. At the moment my catalog consists
I have a cart table which has a relation to a product table that
Hi i'm creating an app which have shopping cart and payment done via paypal
I have a header.html which start with session_start();. Then the following code, $_SESSION['cart'][$sw_id] is
Alright, Heres the thing. I have a (paid for) shopping cart, which I am
I have a cart on my website and I need to let users easily
I have made a cart and the cart has remove item button, but the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.