PHP Nubsauce Posted August 29, 2008 Share Posted August 29, 2008 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 =] Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/ Share on other sites More sharing options...
genericnumber1 Posted August 29, 2008 Share Posted August 29, 2008 how do you know an error exists? put error_reporting(E_ALL); at the top and get back to us with the message. If there is none, tell us what the problem is. Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629260 Share on other sites More sharing options...
kratsg Posted August 29, 2008 Share Posted August 29, 2008 Echo out the sql query being made and put it here. Also, $requestmessage is using single quotes meaning everything inside is being treated as a literal (rather than a variable, which may be what you need). Surround it with double quotes instead. IE: $foo = "bar"; echo $foo; echo "$foo"; echo '$foo'; The above will echo in this order: bar bar $foo Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629261 Share on other sites More sharing options...
PHP Nubsauce Posted August 29, 2008 Author Share Posted August 29, 2008 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 } ?> Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629264 Share on other sites More sharing options...
genericnumber1 Posted August 29, 2008 Share Posted August 29, 2008 how do you know an error exists? Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629267 Share on other sites More sharing options...
kratsg Posted August 29, 2008 Share Posted August 29, 2008 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. That's how you know o_o Ok, so let's look at that query. Add in echo $sql; right before that conditional and paste what shows. Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629270 Share on other sites More sharing options...
genericnumber1 Posted August 29, 2008 Share Posted August 29, 2008 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. That's how you know o_o Ok, so let's look at that query. Add in echo $sql; right before that conditional and paste what shows. I totally didn't see that my first read through thanks. Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629271 Share on other sites More sharing options...
PHP Nubsauce Posted August 29, 2008 Author Share Posted August 29, 2008 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' Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629272 Share on other sites More sharing options...
PHP Nubsauce Posted August 29, 2008 Author Share Posted August 29, 2008 hmm continuous and volt12 are screwed up =[ Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629276 Share on other sites More sharing options...
PHP Nubsauce Posted August 29, 2008 Author Share Posted August 29, 2008 figured it out, a field in my database dident match my insert into, lol, what a nub thx for the help Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629292 Share on other sites More sharing options...
kratsg Posted August 29, 2008 Share Posted August 29, 2008 LOL, that should've thrown an error. Quote Link to comment https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/#findComment-629294 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.