Jump to content

PHP Nubsauce

Members
  • Posts

    42
  • Joined

  • Last visited

    Never

Everything posted by PHP Nubsauce

  1. Hi guys, if anybody is able to help - I'm trying to install this function through PHP MyAdmin in the "Run SQL Queries" window. It keeps barfing on my code - if anyone can help me re-write it or help me get this function installed another way, like an external install file or something, that would be great. DELIMITER $$ CREATE FUNCTION LATLON_DIST_MI(lat1 FLOAT, lon1 FLOAT, lat2 FLOAT, lon2 FLOAT ) RETURNS FLOAT DETERMINISTIC BEGIN DECLARE dist FLOAT; SET dist = SIN( RADIANS(lat1) ) * SIN( RADIANS(lat2) ) + COS( RADIANS(lat1) ) * COS( RADIANS(lat2) ) * COS( RADIANS(lon1-lon2) ); SET dist = DEGREES(ACOS(dist)); RETURN dist * 60 * 1.1515; END $$ MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER $$ CREATE FUNCTION LATLON_DIST_MI(lat1 FLOAT, lon1 FLOAT, lat2 FLOAT,' at line 1
  2. Under my ORDER BY, ID can be a number, 1-infinite, I just want to start with number 4, then continue to query the rest, I dont care really about which order after I pull number 4 first. $links = @mysql_query("SELECT * FROM ".$mysql_pretext."_news3 LEFT JOIN ".$mysql_pretext."_news_categories_join3 ON(".$mysql_pretext."_news_categories_join3.news_id = ".$mysql_pretext."_news3.ID) WHERE ".$mysql_pretext."_news_categories_join3.category_id = '7' ORDER BY ID DESC LIMIT 10"); Any ideas?
  3. figured it out, a field in my database dident match my insert into, lol, what a nub thx for the help
  4. hmm continuous and volt12 are screwed up =[
  5. so i added that echo and i get this (ignore all the equal signs, they are just for design (thats not messing it up is it?) INSERT INTO go_requests SET first_name = 'jkhkjh', email = 'jkh', equipment_application = 'jkh', horse_power_required = 'kj', operating_speed = 'hkj', intermittent = 'yes', continuous = '', volt12 = '', volt24 = 'yes', flywheel_size = 'lkjlk', flywheel_sae = 'kljlk', request_message = ' Cooling Systems ======================================== Shipping: Standard: High Ambient: High Debris: yes Suction Fan: Blower Fan: Air Cleaners ======================================== Shipping: Medium Dut: yes Heavy Dut: yes Heavy Dut w/ Pre-Cleaner: Controls ======================================== Shipping: Vernier Throttle: yes Custom Control: Base ======================================== Shipping: Base: Legs: Standard Height: yes Custom Base: yes Sheet Metal ======================================== Shipping: Ship Loose Radiator Grill: Full Enclosure - No Door: Add Doors: yes Custom Enclosur: Paint ======================================== Paint Color: klj Auxiliary/Accessory Drive(s) ======================================== Description: lkj Driven Components ======================================== Shipping: Installed PTO: yes Pump Drive: Custom Driven Component: Driven Component Description: Other Components ======================================== Description: lkj ', request_status_id = '1'
  6. I'm not getting any errors, here's alittle more insight to my code <?php if($_POST['sheetgrill'] == 'yes' || $_POST['sheetnodoor'] == 'yes' || $_POST['sheetdoor'] == 'yes' || $_POST['sheetheight'] != '' || $_POST['sheetshipping'] != ''){ $sheetmetal = 'yes'; $sheetmetalmessage = " Sheet Metal ======================================== Shipping: $_POST[sheetshipping] Radiator Grill: $_POST[sheetgrill] Full Enclosure - No Door: $_POST[sheetnodoor] Add Doors: $_POST[sheetdoor] Custom Enclosur: $_POST[sheetcustom] "; } ?> <?php $firstname = mysql_escape_string($_POST['customername']); $email = mysql_escape_string($_POST['email']); $horsepowerrequired = mysql_escape_string($_POST['horsepowerrequired']); $equipmentapplication = mysql_escape_string($_POST['equipmentapplication']); $operatingspeed = mysql_escape_string($_POST['operatingspeed']); $intermittent = mysql_escape_string($_POST['intermittent']); $continuous = mysql_escape_string($_POST['continuous']); $volt12 = mysql_escape_string($_POST['volt12']); $volt24 = mysql_escape_string($_POST['volt24']); $flywheelsize = mysql_escape_string($_POST['flywheelsize']); $flywheelsae = mysql_escape_string($_POST['flywheelsae']); $requestmessage = "$coolingsystemmessage<br>$aircleanermessage<br>$exhaustsystemsmeesage<br>$insrumentsmessage<br> $controlsmessage<br>$basemessage<br>$sheetmetalmessage<br> $paintmessage<br> $auxiliarymessage<br> $drivenmessage<br> $othermessage<br> $custommessage<br>"; $sql = "INSERT INTO ".$mysql_pretext."_requests " . "SET first_name = '$firstname', email = '$email', equipment_application = '$equipmentapplication', horse_power_required = '$horsepowerrequired', operating_speed = '$operatingspeed', intermittent = '$intermittent', continuous = '$continuous', volt12 = '$volt12', volt24 = '$volt24', flywheel_size = '$flywheelsize', flywheel_sae = '$flywheelsae', request_message = '$requestmessage', request_status_id = '1'"; if (mysql_query($sql)) { ?> <?php } ?>
  7. Hey Guys, I was wondering if you could help my find my error in my code. I've been trying different things and staring for hours and about to go crazy. Basically, nothing is inserting into the databse. <?php $firstname = mysql_escape_string($_POST['customernname']); $email = mysql_escape_string($_POST['email']); $horsepowerrequired = mysql_escape_string($_POST['horsepowerrequired']); $equipmentapplication = mysql_escape_string($_POST['equipmentapplication']); $operatingspeed = mysql_escape_string($_POST['operatingspeed']); $intermittent = mysql_escape_string($_POST['intermittent']); $continuous = mysql_escape_string($_POST['continuous']); $volt12 = mysql_escape_string($_POST['volt12']); $volt24 = mysql_escape_string($_POST['volt24']); $flywheelsize = mysql_escape_string($_POST['flywheelsize']); $flywheelsae = mysql_escape_string($_POST['flywheelsae']); $requestmessage = '$coolingsystemmessage<br>$aircleanermessage<br>$exhaustsystemsmeesage<br>$insrumentsmessage<br> $controlsmessage<br>$basemessage<br>$sheetmetalmessage<br> $paintmessage<br> $auxiliarymessage<br> $drivenmessage<br> $othermessage<br> $custommessage<br>'; $sql = "INSERT INTO ".$mysql_pretext."_requests " . "SET first_name = '$firstname', email = '$email', equipment_application = '$equipmentapplication', horse_power_required = '$horsepowerrequired', operating_speed = '$operatingspeed', intermittent = '$intermittent', continuous = '$continuous', volt12 = '$volt12', volt24 = '$volt24', flywheel_size = '$flywheelsize', flywheel_sae = '$flywheelsae', request_message = '$requestmessage', request_status_id = '1'"; if (mysql_query($sql)) { ?> <?php } ?> Thanks for any help =]
  8. wouldent that produce todays date? I need it to liturally be 0000-00-00, because the actual field describes "due date" and sometimes there is none
  9. i cant just store a timestamp cus i have other code that needs 0000-00-00
  10. ok, well thats good advice for the future, but for now the field has to stay as named date. Its working fine other then if the field is left blank. All I need is a simple "if date='' " statement, but I'm not good with dates, whether i need to break it down to y-m-d or not. Any suggestions?
  11. I have a DATE field in my database - and im using a datepicker to add dates. They are obviously added as "0000-00-00" format. There is a blank field next to the date picker, and when you select a date in the datepicker, it add its to the field, and then you hit submit. If you don't add anything, it leaves the field blank. The problem is that if the field is left blank, because theres no specified date to be entered, it just adds a random date, which I can not have. So I need a if statement that says if the field is blank please insert 0000-00-00. I'm no good with dates, so please see if you can help me with this. Does the fix go on the insert into page? Heres how I'm doing it currently - $date = date('Y-m-d',strtotime($_POST['chooseDate'])); $news = mysql_escape_string($_POST['news']); $title = mysql_escape_string($_POST['title']); $addedby = mysql_escape_string($_POST['addedby']); $sql = "INSERT INTO ".$mysql_pretext."_news " . "SET title = '$title', news = '$news', added_by = '$addedby', date = '$date'"; if (mysql_query($sql)) { ?>
  12. Thanks for the help guys, You were right - I had to do it before the where. Thanks, Nubsauce.
  13. I tried else if as well, im not getting any errors, it just doesent display the "None" text heres whats before it .. <?php $links = @mysql_query("SELECT * FROM ".$mysql_pretext."_faq WHERE faq_type_id = '1' ORDER BY question DESC"); if (!$links) { echo("Error retrieving faq from the database!<br>Error: " . mysql_error()); exit(); } while ($link = mysql_fetch_array($links)) { $id = $link["ID"]; $question = $link["question"]; $answer = $link["answer"]; ?> </p> </h1> <p class="text"><strong> <?php if(mysql_num_rows($links) != 0){ ?><?php echo($question); ?></strong> <?php echo($answer); } else { echo('There is currently no FAQ added'); } ?> </p> <p class="text"> <?php } ?>
  14. Can somebody tell me why the if works fine - it shows the database information, but the else does not give the message saying faq hasent been added yet - <?php if(mysql_num_rows($links) != 0){ ?><?php echo($question); ?></strong> <?php echo($answer); } else { echo('There is currently no FAQ added'); } ?> </p> <p class="text"> <?php } ?>
  15. Hey Guys, I always refer to php and sql manuals for easy answers - but this one i can't seem to find fast enough. Can you tell me how to write this script? I've tried $links = @mysql_query("SELECT * FROM ".$mysql_pretext."_users WHERE ID = '1' AND '2'"); as well as $links = @mysql_query("SELECT * FROM ".$mysql_pretext."_users WHERE ID = '1 AND 2'"); and neither worked. Any suggestions? I'm trying to pull only the users with ID 1 and 2 Thanks Nubsauce
  16. First you ask me what my field type is, then you just throw that comment in there afterwards. Thats a big "...." Yes, my field type is date. Thanks, Nubsauce.
  17. I figured this one out myself, thanks for the help tho <?php $links33 = @mysql_query("SELECT * FROM ".$mysql_pretext."_customer_payments LEFT JOIN ".$mysql_pretext."_customers ON (".$mysql_pretext."_customer_payments.customer_id = ".$mysql_pretext."_customers.ID) WHERE referrer_id = '$id' ORDER BY date ASC"); if (!$links33) { echo("Error retrieving projects from the database!<br>Error: " . mysql_error()); exit(); } $rowstotal = mysql_num_rows($links); ?>
  18. <?php $links34 = @mysql_query("SELECT * FROM ".$mysql_pretext."_customers WHERE referrer_id = '$id'"); if (!$links34) { echo("Error retrieving projects from the database!<br>Error: " . mysql_error()); exit(); } while ($link = mysql_fetch_array($links34)) { $customerid = $link["ID"]; $clientcompany = $link["company"]; ?> <?php $links33 = @mysql_query("SELECT * FROM ".$mysql_pretext."_customer_payments WHERE customer_id = '$customerid' ORDER BY date ASC"); if (!$links33) { echo("Error retrieving customer payments from the database!<br>Error: " . mysql_error()); exit(); } ?>
  19. I can't do that, its handshaking with something else :'(
  20. Hey all, see if you can figure this one out.. $links33 = @mysql_query("SELECT * FROM ".$mysql_pretext."_customer_payments WHERE customer_id = '$customerid' ORDER BY date ASC"); I'm trying to display all customer payments from oldest to newest, and its doing that, but its breaking it up by customer! Example: 1-1-08 customer a 2-2-08 customer a 3-3-08 customer a 1-2-08 customer b 2-3-08 customer b 3-4-08 customer b Any help making it look like so: 1-1-08 customer a 1-2-08 customer b 2-2-08 customer a 2-3-08 customer b 3-3-08 customer a 3-4-08 customer b Please? Nubsauce
  21. We've thought about that, but why? Do does my hostmonster.com account have none of this? Their security has to be better then ours, and yet it doesen't have a capthca, a security question, 3 limit try w/ timer, nothing! How do they secure from scripts?
  22. Hello all, pretty simple question ahead. Currently under my php designed login system, we use a captcha code (one of those thingys where its a image of crazy random text and you have to enter it correctly to proceed), but alot of our clients are unhappy with this because the captcha is hard for even a real person to intrepet sometimes, and they end up entering it incorrectly... I know a captcha is pretty good for a user sign-up form, but what about logging in? We've tried doing the three strikes your out for 20 minutes technique - we got alot of complaints about this. We've thought about a security question, but, woulden't just be one more string of charactors to break for a script? Making it still more unreliable then a captcha code. Security can't be compromised, but were trying to get rid of the captcha on simple logins. Any ideas? Thanks, Nubsauce.
×
×
  • 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.