Jump to content

Recommended Posts

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 =]

Link to comment
https://forums.phpfreaks.com/topic/121931-solved-help-find-my-error/
Share on other sites

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

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 } ?>		

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.

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.

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'

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.