Jump to content

[SOLVED] Whats wrong with this line of code.


deansaddigh

Recommended Posts

Thanks very much for your help now i  am getting this error

 

Notice: Undefined index: 21 in C:\wamp\www\Php Shoping cart\index.php on line 104

that line is the code you gave me, im assuming i have done soemthing wrong somewhere else within the code so is it possible to just take alook  at the code

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include 'includes/connection.php';
?>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="images/animated_favicon1.gif" />
<link rel="stylesheet" type="text/css" href="css/layout.css" /> 
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="js/lightbox.js"></script>
<script type="text/javascript" src="js/mojozoom.js"></script>  
<link type="text/css" href="css/mojozoom.css" rel="stylesheet" />  

<title>Nextdayfrags.co.uk</title>
</head>

<body>
<!--wrapper to hold site-->
    <div id="wrapper">
    	
      <!--Logo holder-->
      <div id="header"></div>
        
        <div id="left">
       		<div class="nav">    
       			  	
	        	<ul>
					<li><a href="#">SPS frags</a></li>
					<li><a href="#">LPS frags</a></li>
					<li><a href="#">Soft Coral frags</a></li>
					<li><a href="#">Coral Frag packs</a></li>
					<li><a href="#">SPS Coral Colonies</a></li>
					<li><a href="#">LPS Coral Colonies</a></li>
	        		<li><a href="#">Anemones</a></li>
	        		<li><a href="#">Clean Up Critters/ Inverts</a></li>
	        		<li><a href="#">Coral Food</a></li>
	        		<li><a href="#">Reef Accesories</a></li>
	        		<li><a href="#">Gift Vouchers</a></li>
	        	
				</ul>
        	<div align="center">
        	 <!-- Step 2: add the custom 'data-zoomsrc' attribute to your image to specify the source of the large image -->  
			 <img src="images/paypal.png" data-zoomsrc="images/paypalbig.png" id="myimage" /> 	
        		 
        	</div>
        	</div>
        </div>
        
        	<div id="right">
          		<p>Welcome to Nextdayfrags.com

We offer a variety corals, critters and select dry goods through our online store. Whether you're searching for healhty, colourful SPS coral frags or wanting to add some movement that LPS corals provide, here at mailordercorals, we have you covered. With new shipments arriving all the time, we highly recommend you subscribe to our newsletter, that way you can stay updated - and we may just have some exclusive offers for our mailing list members.

Here at mailordercorals, we aim to offer the very best in customer service and all our livestock comes with our live arrival guarantee, so whether you are a complete novice starting out or an old seasoned reefkeeper, we know you will find something that interests you from our ever growing online catalogue.

Don't forget you can also order over the phone (Sales Hotline: 01383 428590) or come visit our Coral house (by appointment only).

What are you waiting for? Check out the latest additions to our online catalogue below:
          		</p>    
           		         
           <?php  
	   	
			$query = "select product.ProductID, product.ProductName, product.ProductCategory, product.ProductPrice, product.ProductQuantity, product.ProductDescription, image.ImageID, image.ImagePath, image.ImageName, product_image.ImageID, product_image.ProductID
		  FROM product
		  JOIN product_image
		  ON product.ProductID = product_image.ProductID
		  JOIN image
		  ON image.ImageID = product_image.ImageID";

			//Use this query below 		  
			$result = mysql_query($query, $conn)
				or die ("Unable to perform query");

			echo '<table border ="2">';
            	echo '<tr>';
                	echo '<th> Product Name </th>';
                    echo '<th> Product Category</th>';
                    echo '<th> Product Price</th>';
                    echo '<th> Product Description</th>';
				echo '<th> Image </th>';
                echo '</tr>';

			while($row= mysql_fetch_array($result))
			{
				//Get the course id so that can compare the id with the id of the unique to find the relevant section..
				$productname = $row['ProductName'];
				$productcategory = $row['ProductCategory'];
				$productprice = $row['ProductPrice']; 
				$productdescription = $row['ProductDescription'];
				$imagename = $row["ImageName"];
				$imagepath = $row["ImagePath"];
				//Get the product id so i can pass it 
				$productid =$row["ProductID"];
				$file = $imagepath.$imagename;
			?>			
					<tr>

					<!-- Make the product name clickable and pass through its id -->

					<?php echo '<td><a href="product_details.php?productid='.$_POST[$productid].'">' .$productname.'</a>';?>
					<td><?php echo $row['ProductCategory'];?></td>
					<td><?php echo $row['ProductPrice'];?></td>
					<td><?php echo $row['ProductDescription'];?></td>
                        <?php echo '<td><a href="'.$file.'" target="_blank" rel="lightbox"><img src="'.$file.'" width="100" height="100"/></td>';?>


					</tr>
			<?php    	
			}
			  


           		?>
           
           	
           
           	
            
            
            
        </div>
        
      

    
    </div>
   

</body>
</html>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.