Jump to content

moesoap

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

moesoap's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi litebearer, How can I identify which product_id, option_id, and option_value_id is to be printed without hard coding each individual product_id etc in the script. is there anyway to link the <input value="526" /> and the <input type="hidden" value="3" name="id[3]" /> from the html to determine the output of the script? Thanks.
  2. Can someone help me further with this as I am completely stumped. I have changed the script so that it will pull prices from my database based upon products_id, options_id and options_value_id. Rather than a hard coded options_id etc. However I am confused on how to get the script to identify what the product_id etc is. The answer would be placed into a css table so that when I update my prices in the database it will automatically update them on the product listing page. Can an if statement include an html input name and value? If so, this may work for me. Although then I would be hardcoding product_id, options_id and options_value_id again. awwww I have included the code for both. Any suggestions/advice is greatly appreciated. <?php include("includes/configure.php"); // To grab the DB info $db = mysql_connect ("localhost", DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die ('<BR> - Could not connect to the database because: '.mysql_error()); mysql_select_db (DB_DATABASE, $db) or die(mysql_error( )); $productPrices = $query; $query = "select pa.options_values_price from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$_GET['products_id'] . "' and pa.options_id = '" . (int)$products_options_names->fields['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id"; $result = mysql_query($query); if (!$result) { $message = "Error! Invalid Query: ".mysql_error()."\n Original Query: ".$query; die($message); } while($row = mysql_fetch_array($result)){ $productPrices = $row[0]; } mysql_close(); ?> <div class="priceslistfull"><p class="quantity">Quantity</p><p class="productprice1">A4 Posters</p> <p class="productprice2">A3 Posters</p><p class="productprice3">A2 Posters</p><p class="productprice4">A1 Posters</p> <p class="productprice5">A0 Posters</p> <div class="priceunderdiv"><p class="quantityunder">250</p><p class="productprice1under">£<?php echo number_format ($productPrices, 2);?></p> <p class="productprice2under">£<?php echo number_format ($productPrices, 2);?></p><p class="productprice3under">£<?php echo number_format ($productPrices, 2);?></p> <p class="productprice4under">-</p> <p class="productprice5under">-</p></div> <div class="productpurchase"><img src="images/purchase_now1.gif" alt="Spacer Image" width="100" /></div> <div class="productpurchase"><form action="index.php?main_page=product_info&cPath=3_143_38&products_id=526/&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" > <input type="hidden" name="cart_quantity" value="1" maxlength="6" size="4" /> <input type="hidden" name="products_id" value="526" /> <input name="image" type="image" title="Add to Cart" src="images/purchase_now.gif" alt="Add to Cart" /> <input type="hidden" value="3" name="id[3]" /> </form></div> <div class="productpurchase"><form action="index.php?main_page=product_info&cPath=3_143_42&products_id=536/&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" > <input type="hidden" name="cart_quantity" value="1" maxlength="6" size="4" /> <input type="hidden" name="products_id" value="536" /> <input name="image" type="image" title="Add to Cart" src="images/purchase_now.gif" alt="Add to Cart" /> <input type="hidden" value="3" name="id[3]" /> </form></div> <div class="productpurchase"><form action="index.php?main_page=product_info&cPath=3_143_41&products_id=532/&action=add_product" method="post" enctype="multipart/form-data" name="cart_quantity" > <input type="hidden" name="cart_quantity" value="1" maxlength="6" size="4" /> <input type="hidden" name="products_id" value="532" /> <input name="image" type="image" title="Add to Cart" src="images/purchase_now.gif" alt="Add to Cart" /> <input type="hidden" value="3" name="id[3]" /> </form></div>
  3. Lol you have put me in the mood for a pint or two now
  4. brilliant, thank you for your help. I have a lot of reading to do
  5. Thanks for replying. Your answer works but I really dont understand why, I got lost at enumerated indices, and associative indices lol.
  6. Hi Guys, I am a complete novice as you will soon notice. Can anyone suggest what I am doing wrong with this code. When I run the query in phpmyadmin it produces the correct answer. However when I try to output on my site with php it returns the result "Array". I am guessing I have oversimplified somewhere, aint got a clue how though <?php include("configure.php"); // To grab the DB info $dbh = mysql_connect ("localhost", DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die ('<BR> - Could not connect to the database because: '.mysql_error()); mysql_select_db (DB_DATABASE, $dbh) or die(mysql_error( )); $query = "SELECT `options_values_price` FROM `rain_products_attributes` WHERE `products_id` = 526 AND `options_id` = 3 AND `options_values_id` = 3"; $result = mysql_query($query); if (!$result) { $message = "Error! Invalid Query: ".mysql_error()."\n Original Query: ".$query; die($message); } while($row = mysql_fetch_array($result)) { echo $row; } mysql_close(); ?>
×
×
  • 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.