jason213123 Posted January 3, 2012 Share Posted January 3, 2012 hi, i have a class file that have all values from a database fields. for example: class mospedidos extends mosDBTable { id = null; date =null; } class mosunder extends mosDBTable { id = null; name =null; } each time i creat a new field in the database i need add the same field in the class file, what i want is a way using php to add that new field to the class file. i just need a way to open the file and the class name that i give and add the value and save the file. how can i do this? thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/254305-add-values-into-class-file/ Share on other sites More sharing options...
Muddy_Funster Posted January 3, 2012 Share Posted January 3, 2012 a more durable method would be to pull the column info from the table in your parent class and then dynamicly populate the variables from the array info within each class. That would provide a more robust solution and would be easier to impliment. Quote Link to comment https://forums.phpfreaks.com/topic/254305-add-values-into-class-file/#findComment-1303925 Share on other sites More sharing options...
jason213123 Posted January 4, 2012 Author Share Posted January 4, 2012 hi, yes but i also need the default value for example date =null; or date =1; etc so i think in use a form in the script that can creat in same time a field in the database and the same value in the class. in that form i can define the type of the field and the default value that i will be stored in the class file Quote Link to comment https://forums.phpfreaks.com/topic/254305-add-values-into-class-file/#findComment-1303938 Share on other sites More sharing options...
MasterACE14 Posted January 4, 2012 Share Posted January 4, 2012 create an abstract class of which those classes extend, adding new information if need be. Class Abstraction Quote Link to comment https://forums.phpfreaks.com/topic/254305-add-values-into-class-file/#findComment-1303941 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.