update a database

Problems with the Windows version of XAMPP, questions, comments, and anything related.

update a database

Postby manolis1986 » 02. January 2011 09:50

hello to all and happy new year

I have successfully created a database with xampp. In my data base there are 2 tables company(id, name, address, bank account) workers(name, id, comID, compname, compaccount, workeraddress,) id is the primary key in both tables. Bank acount is a unique field for the comany which means that each company has 1 bank acount.
As it is obvious workers wokr in a company. So i have created a "one to many" relationship between company and workers. What i want is for each new worker when i type the compID, the other fields that related to the company ID to be automatically fullfiled.

Thanks Alot
Manolis
manolis1986
 
Posts: 2
Joined: 02. January 2011 09:25

Re: update a database

Postby WilliL » 02. January 2011 12:07

I think the best way is to write a php script.
If your are not familiar with php /mysql there is an interesting page http://www.w3schools.com/PHP/php_intro.asp
Willi
WilliL
 
Posts: 660
Joined: 08. January 2010 10:54
Operating System: Win7Home Prem 64 SP1

Re: update a database

Postby JonB » 03. January 2011 05:46

Ummm.

Does that mean your worker records contain will data (other than the Company ID) from the appropriate 'Company Master'???? OR do you mean you wish to DISPLAY/SELECT that additional Company info??

If you mean the first case, you are not following database normalization best practices. IF you move data from the Company Master (other than the ID field) into employee records, then any change to the shared fields in the Company Master will require updating all the employee records WHERE there is a match on Company ID ...

I'm guessing you did this in MySQL???

If you haven't, you might want to read up on the differences between InnoDB (often used for accounting type work) and MyISAM (often used for text related tasks) - a bit of a broad generalization, but each has a very different strong point that the other lacks (Foreign Keys vs. Full Text Indexing) Storage engine is a table level choice, so a database can use both types - however that leads to a hard-to-manage hybrid processing. (whatever, LOL) :)

You might want to also read up on 'stored procedures' (not for auto-filling, but for routine tasks - like temporary result tables and automated consistency maintenance)

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 194 guests