Jump to content

trichards

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

trichards's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That's actually great help. I was definitely thinking about this backwards. I can take it from here, thank you
  2. FIXED: Used array_combine <select name=""> <? $q = mysql_query("SELECT * FROM products WHERE id='3'"); $r = mysql_fetch_array($q); $sizes = $r['size']; $explode = explode(",", $sizes); $quantity = $r['in_stock']; $explodeq = explode(",", $quantity); $array = array_combine($explode, $explodeq); //print_r($array); foreach ($array as $explode => $explodeq) { ?> <option value="<? echo $explodeq; ?>"><? echo $explode; ?> - <? echo $explodeq; ?></option> <? } ?> </select>
  3. I am trying to combine the size and quantity array as a selection dropdown that displays (Size - Quantity) Ex: (Small - 10). Can I get some help writing the foreach loop. Table: Sizes: small,medium,large,xl Quantity: 10,10,0,10 Code: $q = mysql_query("SELECT * FROM products WHERE id='3'"); $r = mysql_fetch_array($q); // Get Sizes $sizes = $r['size']; $explode_size = explode(",", $sizes); // Get Quantity $quantity = $r['in_stock']; $explode_quantity = explode(",", $quantity); foreach ($explode_size as $sizes) && foreach ($explode_quantity as $quantity) { echo "<option value=\"\">".$sizes." - ".$quantity."</option>" }
  4. I not sure what your asking... I am trying to determine for each order what products we're purchased and how many. Can this be done using my product id succession? If not, how should I store the data in the database?
  5. I am building a simple shopping cart. I store my purchased items in my orders table as comma separated values. Ex. (1,1,2,2,2). The number coincides with product ID and frequency determines the quantity of the product. I am interested in understanding how I can use this information to display: (#Total Quantity of Each Product) Product Name Ex. (3) Product Name Thank you in advance.
×
×
  • 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.