revraz Posted November 27, 2010 Share Posted November 27, 2010 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"; Link to comment https://forums.phpfreaks.com/topic/219350-i-think-im-kinda-close-but-am-going-in-circles-i-think/page/2/#findComment-1140199 Share on other sites More sharing options...
sladepowers Posted November 27, 2010 Author Share Posted November 27, 2010 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 Link to comment https://forums.phpfreaks.com/topic/219350-i-think-im-kinda-close-but-am-going-in-circles-i-think/page/2/#findComment-1140355 Share on other sites More sharing options...
Pikachu2000 Posted November 27, 2010 Share Posted November 27, 2010 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. Link to comment https://forums.phpfreaks.com/topic/219350-i-think-im-kinda-close-but-am-going-in-circles-i-think/page/2/#findComment-1140359 Share on other sites More sharing options...
sladepowers Posted November 27, 2010 Author Share Posted November 27, 2010 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 . i don't know. Link to comment https://forums.phpfreaks.com/topic/219350-i-think-im-kinda-close-but-am-going-in-circles-i-think/page/2/#findComment-1140417 Share on other sites More sharing options...
Pikachu2000 Posted November 27, 2010 Share Posted November 27, 2010 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? Link to comment https://forums.phpfreaks.com/topic/219350-i-think-im-kinda-close-but-am-going-in-circles-i-think/page/2/#findComment-1140426 Share on other sites More sharing options...
sladepowers Posted December 1, 2010 Author Share Posted December 1, 2010 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] Link to comment https://forums.phpfreaks.com/topic/219350-i-think-im-kinda-close-but-am-going-in-circles-i-think/page/2/#findComment-1141750 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.