Forums

Form data not saving to database when fields are TEXT type

pinixdes 07 Jul, 2011
Good Morning

I am trying to figure out why when I changed some fields from VARCHAR to TEXT the form's data won't save to the database. To test - I deleted all the fields that were TEXT type and the form saved correctly. Can anyone please tell me what I am doing wrong?

Below is the code I'm using to save to the database

<?php
if (!class_exists('Tablechronoforms_child_intake_form2')) {
	class Tablechronoforms_child_intake_form2 extends JTable 
	{
		var $cf_id = null;
		var $uid = null;
		var $recordtime = null;
		var $ipaddress = null;
		var $cf_user_id = null;
		var $child_name = null;
		var $child_dob = null;
		var $child_address = null;
		var $child_city_state_zip = null;
		var $child_ssn = null;
		var $child_lasst_grade_complete_school = null;
		var $child_grade_average = null;
		var $child_name_of_school = null;
		var $mother_name = null;
		var $mother_dob = null;
		var $mother_ssn = null;
		var $mother_address = null;
		var $mother_city_state_zip = null;
		var $mother_highest_grade_completed = null;
		var $mother_occupation = null;
		var $mother_place_of_employment = null;
		var $mother_home_phone = null;
		var $mother_work_phone = null;
		var $mother_cell_phone = null;
		var $mother_email = null;
		var $mother_religious_affiliation = null;
		var $father_name = null;
		var $father_dob = null;
		var $father_ssn = null;
		var $father_address = null;
		var $father_city_state_zip = null;
		var $father_highest_grade_completed = null;
		var $father_occupation = null;
		var $father_place_of_employment = null;
		var $father_home_phone = null;
		var $father_work_phone = null;
		var $father_cell_phone = null;
		var $father_email = null;
		var $father_religious_affiliation = null;
		var $guardian_name = null;
		var $guardian_dob = null;
		var $guardian_ssn = null;
		var $guardian_address = null;
		var $guardian_city_state_zip = null;
		var $guardian_highest_grade_completed = null;
		var $guardian_occupation = null;
		var $guardian_place_of_employment = null;
		var $guardian_home_phone = null;
		var $guardian_work_phone = null;
		var $guardian_cell_phone = null;
		var $guardian_email = null;
		var $guardian_religious_affiliation = null;
		var $siblings_name = null;
		var $siblings_age = null;
		var $siblings_in_out_of_home = null;
		var $siblings_guardian = null;
		var $other_household_members_name = null;
		var $other_household_members_age = null;
		var $other_household_members_relationship = null;
		var $languages_spoken_in_home2 = null;
		var $number_of_homes_child_lived_in = null;
		var $share_room = null;
		var $day_care = null;
		var $year_natural_parents_married = null;
		var $years_parents_married_before_1st_adoption = null;
		var $in_what_year_parents_separated = null;
		var $languages_spoken_in_home = null;
		var $who_has_custody_child = null;
		var $you_authorized_to_seek_counseling_for_child = null;
		var $year_custodial_parents_married = null;
		var $this_child_is = null;
		var $childs_birth_weight = null;
		var $eating_habits = null;
		var $sleeping_habits = null;
		var $child_approach_to_new_situations = null;
		var $reaction_to_new_stimuli = null;
		var $describe_child_to_new_situations = null;
		var $child_activity_level = null;
		var $age_toilet_trained = null;
		var $age_toilet_established = null;
		var $child_wet_bed = null;
		var $if_wet_bed_how_often = null;
		var $toilet_accidents = null;
		var $if_toilet_accidents_where_is_child = null;
		var $toilet_accidents_occur_when = null;
		var $ever_contacted_a counselor_in_the_past = null;
		var $is_child_on_medication = null;
		var $child_attending_school = null;
		var $child_expected_to = null;
		var $child_ever_failed_a_class = null;
		var $child_receiving_counseling_in_school = null;
		var $if_counseling_from_whom = null;
		var $school_counseling_phone_number = null;
		var $may_we_contact = null;
		var $reffered_by = null;
		var $insurance_company = null;
		var $policy_group = null;
		var $insurance_address = null;
		var $insurance_phone_number = null;
		var $insurance_type = null;
		var $deductible_been_met = null;
		var $parent_digitial_signature = null;
		var $presenting_problem = null;
		var $child_hobbies_skills_interests = null;
		var $compiications_with_pregnancy = null;
		var $explain_irregular_habits = null;
		var $toilet_training_stuggles2 = null;
		var $how_is_discipline_handled_in_the_home = null;
		var $toilet_training_stuggles = null;
		var $what_was_the_outcome_ = null;
		var $describe_medications = null;
		var $special_services_received_at_school = null;
		var $if_failed_explaination = null;
		var $child_interest_hobbies_skills = null;
		var $additional_info = null;

	function __construct( &$database ) {
		parent::__construct( 'jos_chronoforms_child_intake_form2', 'cf_id', $database );
		}
	}
}
$user = JFactory::getUser();			
$row =& JTable::getInstance("chronoforms_child_intake_form2", "Table");
srand((double)microtime()*10000);
$inum	=	"I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );			
if (!$row->bind( $post )) {
  JError::raiseWarning(100, $row->getError());
}				
if (!$row->store()) {
  JError::raiseWarning(100, $row->getError());
}
//$MyForm->tablerow["jos_chronoforms_child_intake_form2"] = $row;


?>
GreyHead 07 Jul, 2011
Hi pinixdes ,

There's no obvious reason. If you turn on Site Debug temporarily you should see list of SQL queries that may give you some better clue about the error.

Bob
pinixdes 08 Jul, 2011
I turned the site debug system on. I do not see and insert clause. Any ideas?
GreyHead 08 Jul, 2011
Hi pinixdes,

If there is no query showing up there then the query isn’t executing.

Next thing is to add debug code to track what is happening. You can add echo "Some message"; to your custom code to give you some clues.

Bob
This topic is locked and no more replies can be posted.