Jump to content


Normalized Tables, but now am confused

  • Please log in to reply
No replies to this topic

#1 kenwvs

  • Members
  • PipPipPip
  • Advanced Member
  • 194 posts

Posted 02 September 2006 - 07:42 PM

I had got to the point where I had all of my data being saved into my Mysql DB, and then it was suggested that I normalize my DB.  I have done that and have ended up with 5 tables and 4 additional tables to join the many->many tables.  The tables I have are workorders, employees, image, parts and remarks.  I have then created work_employees, work_image, work_parts, and work_remarks table to join them together.  I am lost as how to create the query now that will get the data from the form, the data will end up in the proper DB table, and work for me to call it back up to review it in a form later. 

My question is where am I going to want to send them to.  Do they go to the actual table with all the fields, or do I send them to one of the join tables....  I have never done this before, as the query below was my first attempt with php and databases.

Thanks for the help!


Here is an example of the query I was using....

mysql_query ("Insert into `workorder`(ID,Work, Sched, Name, Site, Serial, Hours,
	Starts, Issue, Severity, Resolution, Assistance, NumberA, PartsA, NumberB,
	PartsB, NumberC, PartsC, NumberD, PartsD, NumberE, PartsE, NumberF,	PartsF,
	NumberG, PartsG, Safety) VALUES
	('', '$Work', '$Sched', '$Name', '$Site', '$Serial', '$Hours', '$Starts',
	'$Issue', '$Severity', '$Resolution', '$Assistance', '$NumberA', '$PartsA',
	'$NumberB', '$PartsB', '$NumberC', '$PartsC', '$NumberD', '$PartsD',
	'$NumberE', '$PartsE', '$NumberF', '$PartsF', '$NumberG', '$PartsG',
	or die(mysql_error());

	mysql_query ("Insert into `image`(Upload1, Upload2, Upload3, Upload4) VALUES
	('$Uploads1', '$Uploads2', '$Uploads3', '$Uploads4')")or die(mysql_error());

	echo "Work Order # '$Work' has been Updated Successfully";

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users