Re: learning classes - need pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> In my current case, I am trying to create all the generic SQL
> functions (IE insert, update, delete, etc). Now what I am wondering -
> what would be the best way to structure the code so that I can
> accommodate the possibilities for different fields and databases,
> etc? Is it something that I should just pass to the class? Or would
> there be a more efficient way to do it?

 One of the things I hate most is having to rewrite code for insert and 
update. With that in mind what I do is name the form objects the same name 
as the db fields that they relate to. Then I iterate through the $_POST 
array as a whole and do the insertions and updates like that. The only thing 
that I have to pass to my class is the table name and any location string 
that will accompany the successful completion of the insert/update. All my 
validation is done right there with method overloading.
 It's not extremely clever by any means but it gets the job done. Besides 
I'm kinda lazy.
 I'm sure there are several wrappers that do the same thing.
  alex hogan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux