mikebyrne Posted April 10, 2008 Share Posted April 10, 2008 Im displaying my product info on this page but I want to add an "Add to Cart" button. The static code for the button is <a href="cart.php?action=add&id=22"><img src="Pictures/cdw_tdev_atc_v1_red.gif" class="cartimg" border="0" title="WESTLIFE - Love Album, The - Add to cart!" alt="WESTLIFE - Love Album, The - Add to cart!" height="16" width="60"></a> How can i aply this with use of the varibles below? <?php include("adminconnect.php"); $id = $_GET['id']; $sql = "SELECT * FROM product WHERE ProductNo = '$id'"; $res = mysql_query($sql) or die(mysql_error()); // Since you are getting only one row no neew to loop $row = mysql_fetch_assoc($res); // now just echo all your fields below and format it the way you like echo "Title: ".$row['ProductName']."</a>\n<br> <img src=\"".$row['Image']."\"></img>\n<br> Price ".$row['Price']."\n<br> Description: ".$row['Description']."\n<br>"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.