I am putting together a small shopping. I decided to redo some the code from my earlier versions but this problem is really stumping me.
On the product page the user selects options for the product. For example Colour and size. When the form is submitted the values / numbers from the select menus are put in to array. Using the array I use a foreach loop to query the database
So for example code 3214 is colour red
code 6721 is size small
The problem I am having is that it is not printing the value to screen. I cannot see anything wrong with code.
The array is being created, I tested it using print_r but whatever I do I just get a blank screen.
Do you have any ideas?
// Connect to database
include 'dbconn.inc.php';
$dbcnx = mysql_connect($servername, $username, $password) or die('Connection Failed To Shopping Cart');
mysql_select_db($database) or die('"Unable to locate the shopping basket');
// create an array
$product_choice=array($choice1, $choice2);
//print_r($product_choice);
foreach ($product_choice as $option_number)
{
[INDENT]$query = "SELECT * FROM products_options WHERE product_code_number=$option_number";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result))
{
[INDENT]echo $row['product_option_name'];[/INDENT]
} [/INDENT]
}[/B]