Jump to content

ultraspoon

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ultraspoon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Muddy_Funster Helped me with this before, strangely enough, when he last helped me, it was working fine, nothings changed and it has stopped working.
  2. Hi everyone, I am having a problem with my code. Its hard to explain, so I will try my best. Here is the Query. $partialNumber = $_POST['partialNumber']; // Post the Partial number $partialNumber = strtoupper($partialNumber); $sql = <<<SQL_BLOCK SELECT keynumber_product_option_value_description.product_id, keynumber_product_option_value_description.name, product.image, keynumber_product_option_value.keynumber_product_option_id, keynumber_product_option_value.keynumber_product_option_value_id FROM keynumber_product_option_value_description LEFT JOIN product ON (keynumber_product_option_value_description.product_id = product.product_id) LEFT JOIN keynumber_product_option_value ON (keynumber_product_option_value_description.product_id = keynumber_product_option_value.product_id) WHERE keynumber_product_option_value_description.name LIKE '%$partialNumber%' GROUP BY keynumber_product_option_value_description.name SQL_BLOCK; $result= mysql_query($sql) or die(mysql_error()); $display = ''; while ($row = mysql_fetch_array($result)){ $display .= <<<HTML_BLOCK Here are the bits for the database -- Table structure for table `keynumber_product_option` -- CREATE TABLE `keynumber_product_option` ( `keynumber_product_option_id` int(11) NOT NULL AUTO_INCREMENT, `product_id` int(11) NOT NULL, `sort_order` int(3) NOT NULL DEFAULT '0', PRIMARY KEY (`keynumber_product_option_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=297 ; -- -------------------------------------------------------- -- -- Table structure for table `keynumber_product_option_description` -- CREATE TABLE `keynumber_product_option_description` ( `keynumber_product_option_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`keynumber_product_option_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Table structure for table `keynumber_product_option_value` -- CREATE TABLE `keynumber_product_option_value` ( `keynumber_product_option_value_id` int(11) NOT NULL AUTO_INCREMENT, `keynumber_product_option_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `quantity` int(4) NOT NULL DEFAULT '0', `subtract` int(1) NOT NULL DEFAULT '0', `price` decimal(15,4) NOT NULL, `prefix` char(1) COLLATE utf8_bin NOT NULL, `sort_order` int(3) NOT NULL, PRIMARY KEY (`keynumber_product_option_value_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=588 ; -- -------------------------------------------------------- -- -- Table structure for table `keynumber_product_option_value_description` -- CREATE TABLE `keynumber_product_option_value_description` ( `keynumber_product_option_value_id` int(11) NOT NULL, `language_id` int(11) NOT NULL, `product_id` int(11) NOT NULL, `name` varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (`keynumber_product_option_value_id`,`language_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- -------------------------------------------------------- -- -- Table structure for table `keynumber_order_option` -- CREATE TABLE `keynumber_order_option` ( `order_keynumber_option_id` int(11) NOT NULL AUTO_INCREMENT, `order_id` int(11) NOT NULL, `order_product_id` int(11) NOT NULL, `product_keynumber_option_value_id` int(11) NOT NULL DEFAULT '0', `name` varchar(255) COLLATE utf8_bin NOT NULL, `value` varchar(255) COLLATE utf8_bin NOT NULL, `price` decimal(15,4) NOT NULL DEFAULT '0.0000', `prefix` char(1) COLLATE utf8_bin NOT NULL DEFAULT '', PRIMARY KEY (`order_keynumber_option_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; I have 4 items added for the search so far. When I search for "C" for example, the four items will appear, with this information Keynumber Option ID314 Keynumber Option value676 Product id 3947 Keynumber Option ID314 Keynumber Option value676 Product id 3947 Keynumber Option ID315 Keynumber Option value678 Product id 3961 Keynumber Option ID315 Keynumber Option value678 Product id 3961 The problem is, the Keynumber Option Values, should be different for each item. They should be 675 676 677 678 So my query is not looping through, its just assigning the same value for each. Any help would be greatly appreciated, as I am so close to getting this to work. Thank you
  3. Fixed it, i put this. $sql = <<<SQL_BLOCK SELECT product_option_value_description.product_id, product_option_value_description.name, product.image, product_option_value.product_option_id, product_option_value.product_option_value_id FROM product_option_value_description LEFT JOIN product ON (product_option_value_description.product_id = product.product_id) LEFT JOIN product_option_value ON (product_option_value_description.product_id = product_option_value.product_id) WHERE product_option_value_description.name LIKE '%$partialNumber%' GROUP BY product_option_value_description.name SQL_BLOCK; Thanks dude.
  4. Hmm, that's only displaying 2 products now, not 4.
  5. Thanks for all your help, Muddy_Funster and dmikester1, Ive manged to sort out all the small issues, so the code is now fully working! There is only one small issue now, when you do a search, it shows two of each of the same products, instead of just one. In my test store, I have 2 products each with 2 option values, so it should show 4 products, not 8. This is the last thing now I promise! Thank you $partialNumber = $_POST['partialNumber']; // Post the Partial number $partialNumber = strtoupper($partialNumber); $sql = <<<SQL_BLOCK SELECT product_option_value_description.product_id, product_option_value_description.name, product.image, product_option_value.product_option_id, product_option_value.product_option_value_id FROM product_option_value_description LEFT JOIN product ON (product_option_value_description.product_id = product.product_id) LEFT JOIN product_option_value ON (product_option_value_description.product_id = product_option_value.product_id) WHERE product_option_value_description.name LIKE '%$partialNumber%' SQL_BLOCK; $result= mysql_query($sql) or die(mysql_error()); $display = ''; while ($row = mysql_fetch_array($result)){ $display .= <<<HTML_BLOCK <div> <br /><br /> Key Number: {$row['name']}</a> <form action="http://www./teststore/index.php?route=checkout/cart" method="post" enctype="multipart/form-data" id="product"> <br /> <table style="width: 100%;"> <tr> <td> <select name="option[{$row['product_option_id']}]"> <option value="{$row['product_option_value_id']}"></option> </select></td> </tr> </table> <div class="content"> Qty: <input type="text" name="quantity" size="3" value="1" /> <input type="hidden" name="product_id" value="{$row['product_id']}" /> <input name="submit" type="submit" value="Add to Cart" /> </div> </form> </div> <br /> <img height="150" width="150" src='http://www..co.uk/teststore/image/{$row['image']}'> HTML_BLOCK; } echo $display; ?>
  6. Hi Muddy_Funster, I think im close, im trying to figure this out now, and ive got one error, Parse error: syntax error, unexpected '{' in getKeynumber.php on line 18 while ($row = mysql_fetch_array($result){
  7. Ahh brilliant Muddy_Funster, thanks for that, I was acctually looking up how to do a loop inside a loop before you posted you last message, hopefully this will work now, ill post back after I have had a play. Thank you.
  8. Thanks Muddy_Funster, It has been a long while since I was last coding, im surprised I have managed to throw that together. From what I remember there are a few different kind of loops. Could you point me in the direction of which kind and then I can research into it. Thank you
  9. Hi everyone, I need a little bit of help finishing off my code. Ive managed to get this far. <?php mysql_connect("") or die ("Not Connected to MYSQL"); echo "</br>"; mysql_select_db("") or die ("Not Connected to DB"); // Database Connection stuff $partialNumber = $_POST['partialNumber']; // Post the Partial number $partialNumber = strtoupper($partialNumber); $numberSearch = mysql_query("SELECT * FROM product_option_value_description WHERE name LIKE '%$partialNumber%'") or die (mysql_error()); // Query to select the key number //Query to get product ID // $productId = "SELECT product_id FROM product_option_value_description"; //Query to get product ID // while ($keyNumber = mysql_fetch_array($numberSearch)) { $id = $keyNumber['product_id']; // Query for the images // $query = "SELECT image FROM product WHERE product_id = '$id'"; $result = mysql_query($query); $row = mysql_fetch_array($result) or die(mysql_error()); $query2 = "SELECT product_option_id FROM product_option_value WHERE product_id = '$id'"; $result2 = mysql_query($query2); $row2 = mysql_fetch_array($result2) or die(mysql_error()); $query3 = "SELECT product_option_value_id FROM product_option_value WHERE product_id = '$id'"; $result3 = mysql_query($query3); $row3 = mysql_fetch_array($result3) or die(mysql_error()); ?> <div> <br /><br /> Key Number: <? echo $keyNumber['name']; ?></a> <form action="http://www.co.uk/teststore/index.php?route=checkout/cart" method="post" enctype="multipart/form-data" id="product"> <br /> <table style="width: 100%;"> <tr> <td> Colour: <select name="option[<? echo $row2['product_option_id']; ?>]"> <option value="<? echo $row3['product_option_value_id']; ?>"></option> </select></td> </tr> </table> <div class="content"> Qty: <input type="text" name="quantity" size="3" value="1" /> <input type="hidden" name="product_id" value="<? echo $id; ?>" /> <input name="submit" type="submit" value="Add to Cart" /> </div> </form> <? echo $row3['product_option_value_id']; ?> </div> <br /> <img height="150" width="150" src='http://www.co.uk/teststore/image/<? echo $row['0']; ?>'/> <? } ?> And here is my SQL Table code. product_option_value_id product_option_id product_id 599 302 49 598 302 49 589 297 42 588 297 42 So as you can probably tell, it is a search program that looks for products on a shopping cart. The products will have different option values, and the php script will grab the option values and echo them in a form to post back to the cart to add the product to the basket. The problem is that the "product_option_value_id" can have lots of different values, but my code echos only the first one it finds. So when I click the add to cart button, it will only add the first option value for the product it finds. For some reason I am having a hard time explaining this, so I hope someone can help me. Thanks for looking.
  10. Thank you all, Sorry PFMaBiSmAd, i should of posted all of my code. Thanks for the link cyberRobot, i do understand, all of the post and get methods I am using them in my code somewhere, but the user who hit it on the head was micmania1!!! Woo!! I ended up having the Variables with capital letters, changed them to lower case and it works fine. Thanks all, I should come here more often, you lot are so helpful. Thank you
  11. in page one, from a piece of JavaScript code from a Google map.
  12. Hellooo, I have a map on my site, a user types in there postcode, and clicks next, then a new page opens, the latitude and longitude, is passed from page one, to page two, the user then types in their details and clicks send. The details are then sent to me. But the latitude and longitude is not being sent in the email. Heres a breakdown of my code. Page one. <form method=LINK name="form1" action="apply.php"> <input name="latitude" type="hidden"/> <input type="hidden" name="longitude"/> <input type="submit" value="Submit"> </form This adds the variables to the URL and passes them to next page. Page two <?php $latitude = $_GET['latitude']; $longitude = $_GET['longitude']; ?> This grabs the variables and then. <?php echo "<input type='text' name='Longitude' value='{$latitude}'>"; ?> this places it into a text box, i then send the form just like any others, but it doesnt come through in the email. just blank any suggestions or any better way to do this? Thanks
  13. After 3 weeks of trying to figure this out, ive finally done it, I had a look into that PHPMailer and thought it would be too much work, and more coading. The problem was this $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);//Test //$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);//Live I had my code set to the live version of paypal, not sandbox, I feel so stupid haha. Thanks for your help guys. Thought I would let others know incase they had same issue.
  14. Thanks myrddinwylt, Ill look into that now and let you know how I get on.
  15. Ahh sorry missed that bit out The part thats not working is that im not receiving an email with the password in it. Which is kind of important.
×
×
  • 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.