Page 1 of 1

mysql adds info to 3 out of 4 tables?

Posted: Thu Jun 27, 2002 3:47 pm
by fariquzeli
I have a form that submits data to 4 different tables, it was giving me the error i created if it couldn't make the connection on the second group of data, so I commented that result out, to see if the other 2 tables would work and they did.

So 3 of the 4 table work and if I leave it as is I get the error I have made below the $sql variable. I know the table name is exactly the same because I've checked that several times, and it's in the same db as the other 3 tables surrounding it, here's the code

Code: Select all

mysql_connect($hostname, $user, $pass) 
or die("The site database appears to be down."); 
mysql_select_db("hygienists"); 

$sql="INSERT INTO general SET
              name = '$name',
              title = '$title',
              address = '$address',
              city = '$city',
			  state = '$state',
              zip = '$zip',
			  email = '$email',
			  fax = '$fax',
			  name_purchaser = '$name_purchaser',
              title_purchaser = '$title_purchaser',
              phone = '$phone'";
			  
$result=mysql_query($sql) or die('The database is messed1');

mysql_select_db("hygienists"); 
$sql2="INSERT INTO curriculum SET
			polishing_philosophy = '$polishing_philosophy',
			none_other = '$none_other',
			teaching_year = '$teaching_year',
			teaching_year_semester = '$teaching_year_semester',
			polishing_procedure = '$polishing_procedure',
			ergonomics_taught= '$ergonomics_taught',
			seperate_course = '$seperate_course',
			mandatory_requirement = '$mandatory_requirement',
			hours_received = '$hours_received',
			teaching_imortance = '$teaching_importance',
			prepared_module = '$prepared_module',
			training_product_interest = '$training_product_interest'";
			
$result=mysql_query($sql2) or die('The database is messed2');

mysql_select_db("hygienists"); 
$sql3 = "INSERT INTO products SET
			new_products_chosen = '$new_products_chosen', 
			other_explain = '$other_explain',
			prophy_angle = '$prophy_angle',
			configuration_angle = '$configuration_angle',
			disposable_yearly_usage = '$disposable_yearly_usage',
			disposable_angle_brand = '$disposable_angle_brand',
			angles_purchased = '$angles_purchased',
			prophy_brand_purchased = '$prophy_brand_purchased',
			school_used_handpiece = '$school_used_handpiece',
			school_buys = '$school_buys',
			school_purchases = '$school_purchases',
			student_purchases = '$student_purchases'";
			
$result=mysql_query($sql3) or die('The database is messed3');

mysql_select_db("hygienists"); 	
$sql4 = "INSERT INTO miscellaneous SET
			programs_interesting_students = '$programs_interesting_students',
			suggestions = '$suggestions'";
			
$result=mysql_query($sql4) or die('The database is messed4');
the error i'm getting is the database is messed2

Posted: Thu Jun 27, 2002 3:51 pm
by fariquzeli
woops, my mistake i figured it out.

thanks anyways, hehe.