Jump to content

joshluv33

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

joshluv33's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Well, I figured out that I forgot to change the form action to direct to this update query...instead I had it going through a similar query that used INSERT. The update page and insert page are identical and I overlooked the action......sometimes the most obvious gets overlooked. Thanks.
  2. I am attempting to use a Mysql query to update an existing entry in the db, but every time it runs it adds a new entry instead of updating the existing. Here is the code I'm using: <? # this is processed when the form is submitted # back on to this page (POST METHOD) if ($_SERVER['REQUEST_METHOD'] == "POST") { # escape data and set variables $id = addslashes($_POST["id"]); $cat = addslashes($_POST["category"]); $name = addslashes($_POST["name"]); $submitted_by = addslashes($_POST["submitted_by"]); $ing1 = addslashes($_POST["ing1"]); $ing2 = addslashes($_POST["ing2"]); $ing3 = addslashes($_POST["ing3"]); $ing4 = addslashes($_POST["ing4"]); $ing5 = addslashes($_POST["ing5"]); $ing6 = addslashes($_POST["ing6"]); $ing7 = addslashes($_POST["ing7"]); $ing8 = addslashes($_POST["ing8"]); $ing9 = addslashes($_POST["ing9"]); $ing10 = addslashes($_POST["ing10"]); $ing11 = addslashes($_POST["ing11"]); $ing12 = addslashes($_POST["ing12"]); $ing13 = addslashes($_POST["ing13"]); $ing14 = addslashes($_POST["ing14"]); $ing15 = addslashes($_POST["ing15"]); $text = addslashes($_POST["text"]); mysql_select_db($db_name) or die(mysql_error()); $update = "UPDATE recipes SET category='$category', submitted_by='$submitted_by', name='$name', ing1='$ing1', ing2='$ing2', ing3='$ing3', ing4='$ing4', ing5=$ing5, ing6='$ing6', ing7='$ing7', ing8='$ing8', ing9='$ing9', ing10='$ing10', ing11='$ing11', ing12='$ing12', ing13='$ing13, ing14='$ing14', ing15='$ing15', text='$text' WHERE id = '" . $id . "'"; mysql_query($update) or die(mysql_error()); } ?> All I can figure is that I have the WHERE clause messed up, but I have tried... WHERE id ='23' and it still adds a new entry. Any thoughts would be appreciated. Thanks.
  3. This worked perfectly. I should have known to use (). Thanks.
  4. I am trying to use the following query $ca_result = mysql_query("SELECT * FROM print_options where child = '$x' AND print_id = $print_id order by objorder", $db); to display specific options to be displayed to the client. This works great because the $print_id is sent from another page with no problem. What I need to accomplish though, is to be able to use the above query and to also show all db entries where the print_id = 0. So for instance, if the $print_id = 1, then all the options with print_id = 1 will display, but at the same time I need the options with print_id = 0 to display. So the client will always see options with print_id = 0, but the $print_id will vary and change certain options. I have tried something like this: $ca_result = mysql_query("SELECT * FROM print_options where child = '$x' AND print_id = $print_id OR print_id = '0' order by objorder", $db); but this seems to display all of the options including ones where print_id =1,2,3...etc. I've also tried this: $ca_result = mysql_query("SELECT * FROM print_options where child = '$x' AND print_id = $print_id AND print_id = '0' order by objorder", $db); . This returns no results, frankly because the print_id can't equal a number and 0 at the same time in the query. I just don't know if this is possible or not. Thanks in advance for any help.
  5. I've got a photography website that sells prints of images to clients. I am attempting to implement the imagefilter to produce black & white and sepia previews of the selected image when the client chooses it as an option in the drop down menu. The problem I think I am having currently is setting the right path to the photo or possibly the placement of the code. Here where the image shows up on the php page: echo "<img src=\"watermark.php?i=" . $photo->id . "\" class=\"photos\">"; This is the code for watermark.php: <?PHP //INCLUDE FILES NEEDED TO GET SETTINGS AND WATERMARK include( "database.php" ); include( "functions.php" ); $i = mysql_real_escape_string($_GET['i']); if($_GET['i'] != "" && !is_numeric($_GET['i'])){ header("location: error.php?error=i"); exit; } //GET PHOTO INFO $photo_result = mysql_query("SELECT filename FROM uploaded_images where id = '$i' order by original", $db); $photo = mysql_fetch_object($photo_result); //ADDED FOR SECURITY if($photo->filename != ""){ //DECLARE THIS AS AN IMAGE header("Content-type: image/jpeg"); $image = imagecreatefromjpeg('$photo->filename'); imagefilter($image, IMG_FILTER_GRAYSCALE); imagejpeg($image, 'grayscale.jpeg); imagedestroy($image); //GET SETTINGS $setting_result = mysql_query("SELECT show_watermark,sample_display_quality,sample_width,photo_dir FROM settings where id = '1' limit 1", $db); $setting = mysql_fetch_object($setting_result); //GET WATERMARK if($setting->show_watermark == "1"){ $water_img = "./images/watermark.png"; } else { $water_img = "./images/watermark_off.png"; } //QUALITY LEVEL AND PHOTO PATH $quality = $setting->sample_display_quality; $stock_photo_path = "./" . $setting->photo_dir . "/"; watermark($stock_photo_path . "s_" . $photo->filename,"sample",$water_img,$quality,$setting->sample_width); } ?> As of right now no image will appear in the preview with this code, but when I take out the imagefilter code the original image displays fine. I don't know if I have the proper coding for the path to the image or if I have the imagefilter function in the wrong spot. Thanks for any advice.
  6. I found the problem, it should be: <option value="<?php echo $printtype->price; ?>"> not <option value="<?php $printtype->price; ?>"> Thanks.
  7. The option does have a value. <option value="<?php $printtype->price; ?>">
  8. I created a drop down list from my db which shows a product and the option value is the price associated with that product. I need to have the price value passed to a different page which will add it to some other values to create a total price. Here is the code from the select list: <?php $printtype_result = mysql_query("SELECT id,name,price,quan_avail,bypass FROM prints where quan_avail > 0 order by porder", $db); $printtype_rows = mysql_num_rows($printtype_result); $printtype = mysql_fetch_object($printtype_result); ?> <?PHP echo "<tr><td class=\"photo_details\" bgcolor=\"#F9F9F9\" style=\"border: 1px solid #eeeeee; padding: 10px;\">"; echo "<div align=\"center\" style=\"background-color: #eeeeee; margin-bottom: 10px; padding: 3px;\"><b>".$details_po_purchase_title."</b></div>"; ?> <select name="printprice" style="width:500px;"> <option value=""><?PHP echo $detail_po_select; ?></option> <?php do { ?> <option value="<?php $printtype->price; ?>"><? echo $printtype->name . " - (" . $currency->sign . $printtype->price; ?>)</option> <?php } while($printtype = mysql_fetch_object($printtype_result))?> </select> This list is part of a larger form: <form name="po_order" method="post" action="public_actions.php?pmode=add_cart"> This is from the action page: $printprice = mysql_real_escape_string($_POST['printprice']); after $printprice is captured then it is added to some other values to give a grand total: $grandrm = $price + $po_price + $printprice; I would appreciate any help in retrieving this part of the form data on the action page.
  9. I've attached the code.  Again I appreciate any help with this. [code] function addprice(str) { var itemLoc,itemLocLink; itemLoc=document.getElementById('add2cart'); itemLoc.href=itemLoc.href + str.value; itemLocLink=document.getElementById('add2cartlink'); itemLocLink.href=itemLocLink.href + str.value; } </script>   <? echo "<tr><td class=\"photo_details\" bgcolor=\"#000000\" style=\"border: 1px solid #eeeeee; padding: 5px;\">"; echo "<div align=\"center\" style=\"background-color: #000000; margin-bottom: 10px; padding: 3px;\"><b>Order Prints</b></div>"; $x = 1; $print_result = mysql_query("SELECT * FROM prints where quan_avail > 0 order by 'porder'", $db); $print_rows = mysql_num_rows($print_result); echo "<select name='prints' onChange='addprice(this);'>"; echo "<option>Select Prints</option>"; while($print=mysql_fetch_assoc($print_result)){ $name = $print['name']; $price = $print['price']; $id = $print['id']; echo "<option value='$id'>$name--->$$price</option>\n"; } echo "</select>"; if($print->quan_avail != "999"){ echo "<br />" . $print->quan_avail; } echo "</font><br>"; ?> <? $x = 1; $color_result = mysql_query("SELECT * FROM color", $db); $color_rows = mysql_num_rows($color_result); echo "<select name='color' onChange='addprice(this);'>"; echo "<option>Select Color</option>"; while($color=mysql_fetch_assoc($color_result)){   $name = $color['name'];   $price = $color['price']; echo "<option value='$price'>$name--->$$price</option>\n" } echo "</select>"; if($print->quan_avail != "999"){ echo "<br />" . $print->quan_avail; }echo "</font><br>"; ?> <span style="float: center"><a id="add2cart" href="public_actions.php?pmode=add_cart&amp;ptype=p&amp;gid=<?=$_GET['gid'];?>&amp;sgid=<?=$_GET['sgid'];?>&amp;pid=<?=$_GET['pid'];?>&amp;prid=<?=$print->id;?>" class="photo_links"><img src="images/cart.gif" valign="middle" border="0" /></a> <a id="add2cartlink" href="public_actions.php?pmode=add_cart&amp;ptype=p&amp;gid=<?=$_GET['gid'];?>&amp;sgid=<?=$_GET['sgid'];?>&amp;pid=<?=$_GET['pid'];?>&amp;prid=" class="photo_links">Add To Cart</a></span> [/code]
  10. I am working with existing php code for my photography site which generates two drop down lists.  The code retrieves Mysql info for both the size of print the client wants and separately for the color choice of the photo.  Each table in Mysql has a price associated with the product.  I would like the client to choose both options and have the sum totaled before it is sent to the cart.  Let me show you where I am at now with the code.  I appreciate any help...
×
×
  • 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.