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>"
}