Jump to content

i think i'm kinda close but am going in circles, i think


sladepowers

Recommended Posts

But if there are no errors, it will never echo.  Sometimes if data is missing, it is not a sql error.  So Blue gave you the line to enter to echo the query above.

 

$sql="INSERT INTO register (id, YourFirstName, YourLastName, YourPhoneNumber, YourEmailAddress, BabysFirstName, BabysMiddleName,BabysLastName, BabysBirthdate, BabysAge, BabysHeight, BabysWeight, BabysEyeColor, BabysHairColor, BabysEthnicity) values ( 'NULL','$yourfirstname','$yourlastname', '$yourphonenumber', '$youremailaddress', '$babysfirstname', '$babysmiddlename', '$babyslastname','$babysbirthdate', '$babysage', '$babysheight', '$babysweight', '$babyseyecolor', '$babyshaircolor', '$babysethnicity')";

echo "sql: $sql";

 

hello all;

 

this is what returned when i echoed the script:

 

sql: INSERT INTO register (YourFirstName, YourLastName, YourPhoneNumber, YourEmailAddress, BabysFirstName, BabysMiddleName,BabysLastName, BabysBirthdate, BabysAge, BabysHeight, BabysWeight, BabysEyeColor, BabysHairColor, BabysEthnicity) values ('','', '', '', '', '', '','', '', '', '', '', '', '')

Query string: INSERT INTO register (YourFirstName, YourLastName, YourPhoneNumber, YourEmailAddress, BabysFirstName, BabysMiddleName,BabysLastName, BabysBirthdate, BabysAge, BabysHeight, BabysWeight, BabysEyeColor, BabysHairColor, BabysEthnicity) values ('','', '', '', '', '', '','', '', '', '', '', '', '')

Produced error: Unknown column 'YourFirstName' in 'field list'

 

i would also like to note that it was suggested that i remove the id coloumn and NULL value. when i received this instructions to echo, i removed them both and the return is what is posted above. Thanks

First problem is that there is no conditional to prevent that code from running when the for hasn't been submitted.

Second problem seems to be that there is no field named 'YourFirstName' in that table. Double check the spelling, and note that field names are case-sensitive.

looking at the script there seem to be no misnomers with regard to case sensitive spellings.

here is the script:

 

$yourfirstname = $_POST['YourFirstName'];
$yourlastname = $_POST['YourLastName'];
$yourphonenumber = $_POST['YourPhoneNumber'];
$youremailaddress = $_POST['YourE-mailAddress'];
$babysfirstname = $_POST['BabysFirstName'];
$babysmiddlename = $_POST['BabysMiddleName'];
$babyslastname = $_POST['BabysLastName'];
$babysbirthdate = $_POST['BabysBirthdate'];
$babysage = $_POST['BabysAge'];
$babysheight = $_POST['BabysHeight'];
$babysweight = $_POST['BabysWeight'];
$babyseyecolor = $_POST['BabysEyeColor'];
$babyshaircolor = $_POST['BabysHairColor'];
$babysethicity = $_POST['Babys Ethnicity'];


mysql_select_db("db337879506", $con);
	 $sql="INSERT INTO register (YourFirstName, YourLastName, YourPhoneNumber, YourEmailAddress, BabysFirstName, BabysMiddleName,
	 BabysLastName, BabysBirthdate, BabysAge, BabysHeight, BabysWeight, BabysEyeColor, BabysHairColor, BabysEthnicity) values ('$yourfirstname', 
	 '$yourlastname', '$yourphonenumber', $youremailaddress', '$babysfirstname', '$babysmiddlename', '$babyslastname', 
	 '$babysbirthdate', '$babysage', '$babysheight', '$babysweight', '$babyseyecolor', '$babyshaircolor', '$babysethnicity')";



	  mysql_query($sql, $con) or die ("<br>Query string: $sql<br>Produced error: " . mysql_error() . '<br>');

?>

 

 

with regard to the first problem should i change the html code so there are no "for"s?

thus eliminating the issue altogether?, (a major headache). or shall i change the script to accommodate the "for"?

which way to go? i beg teaching 8).

i  don't know.

I don't follow. What do you mean "accomodate the for"? What "for" would that be?

 

The error returned from MySQL indicates that you do not have a field in the `register table named `YourFirstName`. Did you verify that the field named `YourFirstName` exists in the `register` table, and its spelling, including capitalization, is identical?

hello...thank you for your patience. had a family issue that spanned a few days.

 

well, i'm looking to repair the mysql error. pikachu2000 posted that i don't have a field in the register table named "YourFirstName". i have attached a screenshot

of the structure tab in my phpadmin. additionally, i dropped a field in the table titled "id".

getting a bit closer...thanks all who help.

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

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