Jump to content

craigtolputt

Members
  • Posts

    161
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

craigtolputt's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, I am trying to build a jQuery and PHP love it button where the user clicks it and the number increments and saves to a DB. I have it all working apart from the Saving to the DB part : ) I have this currently to save but it doesnt seem to work. <?php mysql_connect("localhost", "web183-loveit", "password") or die ("Error."); mysql_select_db("web183-loveit") or die ("error"); $increase = "UPDATE results SET value=value+1 WHERE id=1;"; $active_rate = mysql_query("SELECT * FROM results WHERE id=1;"); $val = 0; if($rt = mysql_fetch_assoc($active_rate)) { $val = $rt['value']; } if($_POST['action'] == 'add') { mysql_query($increase); print $val++; } ?> Please see it here http://bit.ly/dKx15z Any ideas?? cheers Craig
  2. Hi Thanks for your response, erm, im not sure if i need to convert or not. I bought this script and it seems to have a few funny bugs throughout but the developers arent helpful at all. What would you suggest?
  3. Hi All, I have a script that i bought and a part of it has a share icon with an email icon so if the user clicks the email icon then it opens up your email client and adds the details of the deal to the email. The problem is that it seems to break each word up by placing a + between them. So for example you get this... Come+and+check+out+Welcome+to+theSocialDeal,+they+have+this+great+local+deal,+if+we+all+buy+it+then+we+get+it+cheaper! Today's+Deal:+4+hours+of+extreme+MTB+action+at+John+Doe+Extreme+Trail+Centre+for+the+price+of+1+hour Click+this+link+to+check+it+out:+ which should be this... Come and check out Welcome to theSocialDeal, they have this great local deal, if we all buy it then we get it cheaper! Today's Deal: 4 hours of extreme MTB action at John Doe Extreme Trail Centre for the price of 1 hour Click this link to check it out: Here is the php function, does anyone know what this could be and how i can stop it? function share_mail($team) { global $login_user_id; global $INI; if (!$team) { $team = array( 'title' => $INI['system']['sitename'] . '(' . $INI['system']['wwwprefix'] . ')', ); } $pre[] = "Come and check out {$INI['system']['sitename']}, they have this great local deal, if we all buy it then we get it cheaper!"; if ( $team['id'] ) { $pre[] = "Today's Deal: {$team['title']}"; $pre[] = "Click this link to check it out: "; $pre[] = $INI['system']['wwwprefix'] . "/team.php?id={$team['id']}&r={$login_user_id}"; $pre = mb_convert_encoding(join("\n\n", $pre), 'UTF-8', 'UTF-8'); $sub = "The Deal: {$team['title']}"; } else { $sub = $pre[] = $team['title']; } $sub = mb_convert_encoding($sub, 'UTF-8', 'UTF-8'); $query = array( 'subject' => $sub, 'body' => $pre, ); $query = http_build_query($query); return 'mailto:?'.$query; }
  4. Quality! Thanks alot for your help i have integrated this now with my form and everything is saving and inserting correctly. cheers all...
  5. Thanks, that seems to work now. So how could i implement that with my form so that it also saves the destination url of the image in my DB?
  6. Hi sorry for the delay in doing this, I did what you said and the page refreshed to this... Warning: copy(/uploads/f2011032545.jpg) [function.copy]: failed to open stream: No such file or directory in /home/thesoc11/public_html/thesocialdeal.co.uk/test_upload.php on line 11 File copy failed
  7. Hi yes the image is NOT in the folder and the image info is NOT in the database either?? And yes the folder permissions are set to 777
  8. Hi, thanks for that but i have tried to implement it with my form and the form saved all the data apart from the image. I didnt get any error message or nothing. Heres my php page <?php include "../connect.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>theSocialDeal | be social and get local deals daily</title> <meta name="description" content="" /> <meta name="keywords" content="" /> <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/> <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen"/> <link rel="stylesheet" href="../css/jqtransform.css" type="text/css" media="all" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script src="../js/cufon-yui.js" type="text/javascript"></script> <script src="../js/aachen.font.js" type="text/javascript"></script> <script type="text/javascript"> Cufon.replace('#nav li', { hover: 'true', fontFamily: 'aachen' }); Cufon.replace('h2.title', { hover: 'true', fontFamily: 'aachen' }); Cufon.replace('p.besocial', { hover: 'true', fontFamily: 'aachen' }); Cufon.replace('a.closebtn', { hover: 'true', fontFamily: 'aachen' }); Cufon.replace('h1.whatis', { hover: 'true', fontFamily: 'aachen' }); Cufon.replace('p.headtitle', { hover: 'true', fontFamily: 'aachen' }); Cufon.replace('p.fieldlabel', { hover: 'true', fontFamily: 'aachen' }); </script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript" src="../js/cookies.js"></script> <script type="text/javascript" src="../js/modalload.js"></script> <script type="text/javascript" src="../js/clickopen.js"></script> <link href="../css/signup.css" rel="stylesheet" type="text/css" /> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="../css/ie7-signup.css"> <![endif]--> </head> <body> <!-- **** Wrapper **** --> <div id="wrap"> <!-- **** Header **** --> <div id="header" style="height:120px;"> <!-- **** Header **** --> <h1 id="logo" style="margin-top:35px;">theSocialDeal</h1> </div> <!-- **** Header **** --> <!-- **** Navigation **** --> <div id="nav"> <ul> <li><a href="../past_deals.html">past Deals</a></li> <li><a href="../index.html">todays Deal</a></li> <li><a href="../future_deals.html">future Deals</a></li> <li><a href="../how_it_works.html">how it Works</a></li> </ul> <div class="loginLinks"> <div class="simpleLink"><a href="#">Login</a> | <a href="#">Register</a></div> <a href="#" class="fconnect">facebook connect</a> </div> </div> <!-- **** Navigation **** --> <!-- **** Main **** --> <div id="main"> <div class="content_top"></div> <!-- **** Content **** --> <div class="content"> <!-- **** Left **** --> <div id="LeftC"> <h1 class="whatis" style="position:relative; float:left; font-family:Arial, Helvetica, sans-serif; font-size:24px; font-weight:normal; color:#0d243f; margin:10px 0 0 5px;"> Promote your business. </h1> <div style="position:relative; float:left; clear:left; width:640px; margin-left:24px; margin-top:20px;"> <? $error = ''; $imagewarn = ''; $name = ''; $company = ''; $address = ''; $phone = ''; $email = ''; $website = ''; $payable = ''; $title = ''; $value = ''; $price = ''; $minpurchase = ''; $maxpurchase = ''; $allowedvouchers = ''; $highlight1 = ''; $highlight2 = ''; $highlight3 = ''; $highlight4 = ''; $highlight5 = ''; $highlight6 = ''; $highlight7 = ''; $highlight8 = ''; $highlight9 = ''; $highlight10 = ''; $fineprint1 = ''; $fineprint2 = ''; $fineprint3 = ''; $fineprint4 = ''; $fineprint5 = ''; $fineprint6 = ''; $fineprint7 = ''; $fineprint8 = ''; $fineprint9 = ''; $fineprint10 = ''; $description = ''; if(isset($_POST['submitemail'])) { $tableName = "deals"; // Where the file is going to be placed $target_path = "/uploads/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $name = $_POST['name']; $company = $_POST['company']; $address = $_POST['address']; $phone = $_POST['phone']; $email = $_POST['email']; $website = $_POST['website']; $payable = $_POST['payable']; $title = $_POST['title']; $value = $_POST['value']; $price = $_POST['price']; $minpurchase = $_POST['minpurchase']; $maxpurchase = $_POST['maxpurchase']; $allowedvouchers = $_POST['allowedvouchers']; $highlight1 = $_POST['highlight1']; $highlight2 = $_POST['highlight2']; $highlight3 = $_POST['highlight3']; $highlight4 = $_POST['highlight4']; $highlight5 = $_POST['highlight5']; $highlight6 = $_POST['highlight6']; $highlight7 = $_POST['highlight7']; $highlight8 = $_POST['highlight8']; $highlight9 = $_POST['highlight9']; $highlight10 = $_POST['highlight10']; $fineprint1 = $_POST['fineprint1']; $fineprint2 = $_POST['fineprint2']; $fineprint3 = $_POST['fineprint3']; $fineprint4 = $_POST['fineprint4']; $fineprint5 = $_POST['fineprint5']; $fineprint6 = $_POST['fineprint6']; $fineprint7 = $_POST['fineprint7']; $fineprint8 = $_POST['fineprint8']; $fineprint9 = $_POST['fineprint9']; $fineprint10 = $_POST['fineprint10']; $description = $_POST['description']; if(trim($name) == '') { $error = '<div class="error_message">What is your name?</div>'; } else if(trim($company) == '') { $error = '<div class="error_message">Please enter a company name</div>'; } else if(trim($phone) == '') { $error = '<div class="error_message">Please enter a contact telephone number</div>'; } else if(trim($email) == '') { $error = '<div class="error_message">Please enter your email address</div>'; } else if(!isEmail($email)) { $error = '<div class="error_message">Please enter a valid email address</div>'; } else if(trim($payable) == '') { $error = '<div class="error_message">Who should we make cheques payable to?</div>'; } else if(trim($title) == '') { $error = '<div class="error_message">Please enter a title for your deal</div>'; } else if(trim($value) == '') { $error = '<div class="error_message">What is the value of your deal?</div>'; } else if(trim($price) == '') { $error = '<div class="error_message">What is the price of your deal?</div>'; } else if(trim($minpurchase) == '') { $error = '<div class="error_message">What is the minumum amount of purchases allowed?</div>'; } else if(trim($maxpurchase) == '') { $error = '<div class="error_message">What is the maximum amount of purchases allowed?</div>'; } else if(trim($allowedvouchers) == '') { $error = '<div class="error_message">How many vouchers are allowed per person?</div>'; } else if(trim($description) == '') { $error = '<div class="error_message">Please enter a deal description</div>'; } else if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { $imagewarn = '<div class="refresh_message">Image has been uploaded</div>'; } else { $imagewarn = '<div class="refresh_message">Your deal image has been uploaded</div>'; } if($error == '') { $insert = mysql_query("INSERT INTO $tableName (name,company,address,phone,email,website,payable,title,value,price,minpurchase,maxpurchase,allowedvouchers,highlight1,highlight2,highlight3,highlight4,highlight5,highlight6,highlight7,highlight8,highlight9,highlight10,fineprint1,fineprint2,fineprint3,fineprint4,fineprint5,fineprint6,fineprint7,fineprint8,fineprint9,fineprint10,description) VALUES ('$name','$company','$address','$phone','$email','$website','$payable','$title','$value','$price','$minpurchase','$maxpurchase','$allowedvouchers','$highlight1','$highlight2','$highlight3','$highlight4','$highlight5','$highlight6','$highlight7','$highlight8','$highlight9','$highlight10','$fineprint1','$fineprint2','$fineprint3','$fineprint4','$fineprint5','$fineprint6','$fineprint7','$fineprint8','$fineprint9','$fineprint10','$description')") or die(mysql_error()); $e_subject = 'Thanks for promoting your business'; $headers = "From: info@thesocialdeal.co.uk\r\n"; $headers .= 'Bcc: craig@thesocialdeal.co.uk' . "\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1 "; $headers .= "MIME-Version: 1.0 "; $msg = ""; $msg .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td align=\"center\" valign=\"top\"><br /> <table width=\"670\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td width=\"670\" height=\"20\" align=\"center\" valign=\"top\" bgcolor=\"#d7ebf6\"><img src=\"http://www.thesocialdeal.co.uk/images/email1.gif\" alt=\"\" width=\"670\" height=\"20\" /></td> </tr> <tr> <td align=\"center\" valign=\"top\" bgcolor=\"#d7ebf6\"><br /> <a href=\"http://www.thesocialdeal.co.uk\"><img src=\"http://www.thesocialdeal.co.uk/images/email2.gif\" alt=\"\" width=\"311\" height=\"47\" border=\"0\" /></a><br /> <p style=\"font-family:Arial, Helvetica, sans-serif; font-size:20px; font-weight:bolder; color:#0d243f;\"><br /> Thanks for promoting your business.</p> <p style=\"font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:normal; color:#0d243f;\">A member of our team will contact you regarding your deal.<br /> You have submitted the following details:</p> <p style=\"font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:bold; color:#0099CC;\"> $name<br /> $company<br /> $address<br /> $phone<br /> $email<br /> $website<br /> $payable<br /> $title<br /> $value<br /> $price<br /> $minpurchase<br /> $maxpurchase<br /> $allowedvouchers<br /> $highlight1<br /> $highlight2<br /> $highlight3<br /> $highlight4<br /> $highlight5<br /> $highlight6<br /> $highlight7<br /> $highlight8<br /> $highlight9<br /> $highlight10<br /> $fineprint1<br /> $fineprint2<br /> $fineprint3<br /> $fineprint4<br /> $fineprint5<br /> $fineprint6<br /> $fineprint7<br /> $fineprint8<br /> $fineprint9<br /> $fineprint10<br /> $description</p> <br /> <p style=\"font-family:Arial, Helvetica, sans-serif; font-size:12px; font-weight:normal; color:#0d243f;\">In the meantime though:</p> <p style=\"font-family:Arial, Helvetica, sans-serif; font-size:16px; font-weight:normal; color:#0d243f;\"><a href=\"http://www.facebook.com/pages/Tamworth-United-Kingdom/TheSocialDeal/140062476046688\"><img src=\"http://www.thesocialdeal.co.uk/images/email3.gif\" alt=\"\" width=\"149\" height=\"33\" border=\"0\" /></a><br /> <br /> <a href=\"http://www.twitter.com/thesocialdeal\"><img src=\"http://www.thesocialdeal.co.uk/images/email4.gif\" alt=\"\" width=\"149\" height=\"33\" border=\"0\" /></a></p> <br /></td> </tr> <tr> <td width=\"670\" height=\"23\" align=\"center\" valign=\"top\"><a href=\"http://www.thesocialdeal.co.uk\"><img src=\"http://www.thesocialdeal.co.uk/images/email5.gif\" alt=\"\" width=\"670\" height=\"23\" border=\"0\" /></a></td> </tr> </table> <p> </p></td> </tr> </table>"; mail($email, $e_subject, $msg, $headers); // Email has sent successfully, echo a success page. echo "<div id='succsess_page'>"; echo "<h1>Thanks, a member of our team will contact you about your deal.</h1>"; echo "</div>"; } } if(!isset($_POST['submitemail']) || $error != '') // Do not edit. { ?> <? echo $error; ?> <form enctype="multipart/form-data" method="post" action=""> <p class="headtitle">Company Details</p> <p class="fieldlabel">Full Name</p> <input name="name" type="text" id="name" size="30" value="" class="thefield"/> <p class="fieldlabel">Company</p> <input name="company" type="text" id="company" size="30" value="" class="thefield"/> <p class="fieldlabel">Address</p> <textarea name="address" cols="40" rows="3" id="address" class="thefield"></textarea> <p class="fieldlabel">Telephone</p> <input name="phone" type="text" id="phone" size="30" value="" class="thefield"/> <p class="fieldlabel">Email</p> <input name="email" type="text" id="email" size="30" value="" class="thefield"/> <p class="fieldlabel">Website</p> <input name="website" type="text" id="website" size="30" value="" class="thefield"/> <p class="fieldlabel">Cheques Payable to</p> <input name="payable" type="text" id="payable" size="30" value="" class="thefield"/> <p class="headtitle">The Deals Details</p> <p class="fieldlabel">Deal Title</p> <input name="title" type="text" id="title" size="30" value="" class="thefield"/> <p class="fieldlabel">Deal Value</p> <input name="value" type="text" id="value" size="30" value="" class="thefield"/> <p class="fieldlabel">Deal Price</p> <input name="price" type="text" id="price" size="30" value="" class="thefield"/> <p class="fieldlabel">Minimum Purchases</p> <input name="minpurchase" type="text" id="minpurchase" size="30" value="" class="thefield"/> <p class="fieldlabel">Maximum Purchases</p> <input name="maxpurchase" type="text" id="maxpurchase" size="30" value="" class="thefield"/> <p class="fieldlabel">Allowed Vouchers Per Person</p> <input name="allowedvouchers" type="text" id="allowedvouchers" size="30" value="" class="thefield"/> <p class="fieldlabel">Deal Highlights <span style="font-size:12px; color:#0d243f;">(Max 10)</span></p> <input name="highlight1" type="text" id="highlight1" size="30" value="" class="thefield"/> <input name="highlight2" type="text" id="highlight2" size="30" value="" class="thefield"/> <input name="highlight3" type="text" id="highlight3" size="30" value="" class="thefield"/> <input name="highlight4" type="text" id="highlight4" size="30" value="" class="thefield"/> <input name="highlight5" type="text" id="highlight5" size="30" value="" class="thefield"/> <input name="highlight6" type="text" id="highlight6" size="30" value="" class="thefield"/> <input name="highlight7" type="text" id="highlight7" size="30" value="" class="thefield"/> <input name="highlight8" type="text" id="highlight8" size="30" value="" class="thefield"/> <input name="highlight9" type="text" id="highlight9" size="30" value="" class="thefield"/> <input name="highlight10" type="text" id="highlight10" size="30" value="" class="thefield"/> <p class="fieldlabel">The Fine Print <span style="font-size:12px; color:#0d243f;">(Max 10)</span></p> <input name="fineprint1" type="text" id="fineprint1" size="30" value="" class="thefield"/> <input name="fineprint2" type="text" id="fineprint2" size="30" value="" class="thefield"/> <input name="fineprint3" type="text" id="fineprint3" size="30" value="" class="thefield"/> <input name="fineprint4" type="text" id="fineprint4" size="30" value="" class="thefield"/> <input name="fineprint5" type="text" id="fineprint5" size="30" value="" class="thefield"/> <input name="fineprint6" type="text" id="fineprint6" size="30" value="" class="thefield"/> <input name="fineprint7" type="text" id="fineprint7" size="30" value="" class="thefield"/> <input name="fineprint8" type="text" id="fineprint8" size="30" value="" class="thefield"/> <input name="fineprint9" type="text" id="fineprint9" size="30" value="" class="thefield"/> <input name="fineprint10" type="text" id="fineprint10" size="30" value="" class="thefield"/> <p class="fieldlabel">Full Description</p> <textarea name="description" cols="40" rows="3" id="description" class="thefield"></textarea> <p class="fieldlabel">Deal Image</p> <? echo $imagewarn; ?> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <input type="file" name="image" id="inp" class="thefield"> <input name="submitemail" type="submit" id="submitemail" class="senddeal" value="promote this deal"/> </form> <? } function isEmail($email) { // Email address verification, do not edit. return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email)); } ?> </div> </div> <!-- **** Left **** --> <!-- **** Right **** --> <div id="RightC"> <a href="#" class="banner"></a> <div class="fbholder"> <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/pages/Tamworth-United-Kingdom/TheSocialDeal/140062476046688" width="232"></fb:like-box></div> </div> <!-- **** Right **** --> </div> <!-- **** Content **** --> <div class="content_bottom"></div> </div> <!-- **** Main **** --> </div> <!-- **** Wrapper **** --> <div id="popup_name" class="popup_block"> <a class="close" title="Close this window">Close</a> <h1 class="smlogo">theSocialDeal</h1> <h2 class="title">Who wants to be notified about the best deals in <span>Tamworth</span>?</h2> <iframe name="signup" src="../signupDB.php" width="672" height="77" frameborder="0" scrolling="auto" class="iframe" allowtransparency="true"></iframe> <a href="#" class="closebtn" title="What is theSocialDeal?">What is the<span>Social</span>Deal?</a> <a href="http://www.twitter.com/thesocialdeal" class="smltwitter" title="Follow us on twitter">twitter</a> <a href="http://www.facebook.com/pages/Tamworth-United-Kingdom/TheSocialDeal/140062476046688" class="smlfacebook" title="Become a fan of theSocialDeal">facebook</a> <p class="besocial">be social</p> </div> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-8333979-3']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </body> </html> What do you think could be the issue? thanks Craig
  9. Hi Guys, Please can someone here help me with a simple browse for an image from the computer and then when the form is submitted it uploads the image and then saves the image url in my DB. my form page is here http://bit.ly/gntCvD Any help will be appreciated. thanks Craig
  10. Sorry still no luck, This is what i have altogether now... <?php include "connect.php"; $tableName = "pricelist"; $quantity = $_POST['quantity']; $size = $_POST['size']; $stock = $_POST['stock']; $colours = $_POST['colours']; $sides = $_POST['sides']; $variations = $_POST['variations']; if(isset($_POST['getprice'])) { $sql1 = mysql_query("SELECT price FROM $tableName WHERE quantity = '$quantity' AND size = '$size' AND stock = '$stock' AND colours = '$colours' AND sides = '$sides' AND variations = '$variations'"); $row1 = mysql_num_rows($sql1); //if there is a result it will be either 1 or higher if($row1 >= 1) { // ONE OR MORE ROWS $dbData = mysql_fetch_assoc($sql1); // GET THE DATA FROM THE FIRST ROW // IF $row1 IS GREATER THAN 1, THIS MAY NOT BE THE CORRECT PRICE $price = $dbData['price']; } } ?>
  11. I wonder if you can help me?? I need the user to select an option from 6 different drop downs and then i need to check a DB to see if there is a row that contains all the values, if theres is a row with all the values in then i need to return or echo the price value from that row??? do you know how to do this?
  12. Thanks, so somthing like this do you think? <?php include "connect.php"; $tableName = "pricelist"; //Post all of the users information (md5 Encrypt the dna_no) $sql1 = mysql_query("SELECT price FROM $tableName WHERE quantity = '$quantity' AND size = '$size' AND stock = '$stock' AND colours = '$colours' AND sides = '$sides' AND variations = '$variations'"); $row1 = mysql_num_rows($sql1); //if there is a result it will be either 1 or higher if($row1 > 1) { $price = $_GET['price']; } if(isset($_POST['contactus'])) { $quantity = $_POST['quantity']; $size = $_POST['size']; $stock = $_POST['stock']; $colours = $_POST['colours']; $sides = $_POST['sides']; $variations = $_POST['variations']; } ?>
  13. I have setup the DB so that every different option is accounted for so i have the following and i just need to return the price that matches the row that the user selects so colours+size+quantity+sides+stock+variations == Return Price in that row id colours size quantity sides price stock variations 902 1 A5 0-99 Single 103 250gsm Silk Artpaper 1 903 1 A5 100-199 Single 104 250gsm Silk Artpaper 1 904 1 A5 200-299 Single 105 250gsm Silk Artpaper 1 905 1 A5 300-399 Single 106 250gsm Silk Artpaper 1 906 1 A5 400-499 Single 107 250gsm Silk Artpaper 1 907 1 A5 500-599 Single 108 250gsm Silk Artpaper 1 908 1 A5 600-699 Single 109 250gsm Silk Artpaper 1 909 1 A5 700-799 Single 110 250gsm Silk Artpaper 1 910 1 A5 800-899 Single 111 250gsm Silk Artpaper 1 911 1 A5 900-999 Single 112 250gsm Silk Artpaper 1 912 1 A5 1000-1099 Single 113 250gsm Silk Artpaper 1 913 1 A5 1100-1199 Single 114 250gsm Silk Artpaper 1
  14. **** BUMP ******** BUMP ******** BUMP ******** BUMP **** Is this really hard to accomplish? I thought that it would be easy but i have searched the internet all day now and still i cant find an answer. Please if someone knows how to do this i need to learn please please **** BUMP ******** BUMP ******** BUMP ******** BUMP ****
  15. Sorry i dont fully understand, what i want to do is basically return the value in the price field if the other fields match up you can see the form here http://bit.ly/9yDO8T and in my db i have all the different combinations listed so what ever the user selects from the drop down lists there will be a price value
×
×
  • 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.