HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=33)
-   -   Storing form data in more than one db table (http://www.howtoforge.com/forums/showthread.php?t=57668)

Croydon 19th June 2012 11:19

Storing form data in more than one db table
 
I'm just at trying to implement this
http://www.howtoforge.com/forums/showthread.php?t=57628

I want to create separate database and db_user forms - that is no problem.
But to keep things easy for unexperienced users I want to (mainly) maintain the current database editing form and make the new ones optional.
My question is: Is it possible to store information from one form into separate db tables?

To make things clearer:
There are three db tables.
- databases
- database users
- db <-> user link table

When using the current simple database editing form after saving and before displaying the data have to be stored to / read from those three tables.
In the form definition files and server module/plugins I found the possibility to only give one single table.
Theoretically I could store the data in the second / third table by hand, but as far as I can see the datalog and therefor the server modules would not recognize those changes.
Could you (till/falko) give me some hint on how to proceed here?

Thank you.

till 19th June 2012 11:54

Quote:

Is it possible to store information from one form into separate db tables?
Not with the default functions of the form, but you can ovverride each function. see tform_actions class which to see which even functions can be overridden.

Btw. I would still prefer if you implement i as direct user -> DB relationship and not with 3 tables, so that you have a users table and a db table and one user can access one or more databases. This woould fit into the form framework better, is simpler to understand for the user.

Quote:

but as far as I can see the datalog and therefor the server modules would not recognize those changes.
This would only be the case if you use the wrong functions to from the db class to insert and update data into this table. If you use the datalogInsert(), datalogUpdate() and datalogDelete() functions to insert data to that table, then all data is mirrored to slave servers as well and you can create a event hook in a server side plugin.

till 19th June 2012 11:54

Quote:

Is it possible to store information from one form into separate db tables?
Not with the default functions of the form, but you can ovverride each function. see tform_actions class which to see which even functions can be overridden.

Btw. I would still prefer if you implement i as direct user -> DB relationship and not with 3 tables, so that you have a users table and a db table and one user can access one or more databases. This woould fit into the form framework better, is simpler to understand for the user.

Quote:

but as far as I can see the datalog and therefor the server modules would not recognize those changes.
This would only be the case if you use the wrong functions to from the db class to insert and update data into this table. If you use the datalogInsert(), datalogUpdate() and datalogDelete() functions to insert data to that table, then all data is mirrored to slave servers as well and you can create a event hook in a server side plugin.

Croydon 19th June 2012 13:10

Quote:

Originally Posted by till (Post 280843)
Btw. I would still prefer if you implement i as direct user -> DB relationship and not with 3 tables, so that you have a users table and a db table and one user can access one or more databases. This woould fit into the form framework better, is simpler to understand for the user.

I get your point but I think it is much more useful to have multiple users for one database than having multiple databases for each user.
I know it is easier using phpmyadmin because you have a listing of all databases of the user, but I still believe it is lot more benefit having read-only user(s) to access a database.
So if you want to have multiple databases for a user and multiple users for a database I think there is no way to manage this using only 2 tables, although it would fit better into the form framework. Don't you agree?


All times are GMT +2. The time now is 00:31.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.