Inserting the actual string $variable into the db
Posted: Tue Jul 09, 2002 12:13 pm
I have some php that is supposed to add in numbers into a db that were added into a form field on a previous page. The problem is that the form is entering the actual variable names as strings into the db
ex. The field's name is $1_spring, rather than entering the number 7 that was put into that field, it puts in $1_spring. here is the code:
їcode]$sql2="INSERT INTO curriculum SET
polishing_philosophy = '$polishing_philosophy',
teaching_year = '$teaching_year',
teaching_year_semester = '$teaching_year_semester',
polishing_procedure = '$polishing_procedure',
ergonomics_taught= '$ergonomics_taught',
seperate_course = '$seperate_course',
hours_received = '$hours_received',
teaching_importance = '$teaching_importance',
prepared_module = '$prepared_module',
1_fall = '$1_fall',
2_fall = '$2_fall',
3_fall = '$3_fall',
4_fall = '$4_fall',
1_fall2 = '$1_fall2',
2_fall2 = '$2_fall2',
3_fall2 = '$3_fall2',
4_fall2 = '$4_fall2',
1_spring = '$1_spring',
2_spring = '$2_spring',
3_spring = '$3_spring',
4_spring = '$4_spring',
1_spring2 = '$1_spring2',
2_spring2 = '$2_spring2',
3_spring2 = '$3_spring2',
4_spring2 = '$4_spring2',
1_summer = '$1_summer',
2_summer = '$2_summer',
3_summer = '$3_summer',
4_summer = '$4_summer',
1_summer2 = '$1_summer2',
2_summer2 = '$2_summer2',
3_summer2 = '$3_summer2',
4_summer2 = '$4_summer2',
teaching_year2 = '$teaching_year2',
teaching_year_semester2 = '$teaching_year_semester2',
hours_ergonomics_module = '$hours_ergonomics_module'";ї/code]
all of the fields with the odd numbers for names are inputting the $string into the db rather than the number, all the normally named fields are entering info fine.
ex. The field's name is $1_spring, rather than entering the number 7 that was put into that field, it puts in $1_spring. here is the code:
їcode]$sql2="INSERT INTO curriculum SET
polishing_philosophy = '$polishing_philosophy',
teaching_year = '$teaching_year',
teaching_year_semester = '$teaching_year_semester',
polishing_procedure = '$polishing_procedure',
ergonomics_taught= '$ergonomics_taught',
seperate_course = '$seperate_course',
hours_received = '$hours_received',
teaching_importance = '$teaching_importance',
prepared_module = '$prepared_module',
1_fall = '$1_fall',
2_fall = '$2_fall',
3_fall = '$3_fall',
4_fall = '$4_fall',
1_fall2 = '$1_fall2',
2_fall2 = '$2_fall2',
3_fall2 = '$3_fall2',
4_fall2 = '$4_fall2',
1_spring = '$1_spring',
2_spring = '$2_spring',
3_spring = '$3_spring',
4_spring = '$4_spring',
1_spring2 = '$1_spring2',
2_spring2 = '$2_spring2',
3_spring2 = '$3_spring2',
4_spring2 = '$4_spring2',
1_summer = '$1_summer',
2_summer = '$2_summer',
3_summer = '$3_summer',
4_summer = '$4_summer',
1_summer2 = '$1_summer2',
2_summer2 = '$2_summer2',
3_summer2 = '$3_summer2',
4_summer2 = '$4_summer2',
teaching_year2 = '$teaching_year2',
teaching_year_semester2 = '$teaching_year_semester2',
hours_ergonomics_module = '$hours_ergonomics_module'";ї/code]
all of the fields with the odd numbers for names are inputting the $string into the db rather than the number, all the normally named fields are entering info fine.