PHP extending class properties -


I have two classes in a PHP application, for example B extension A. Class A has a function that gives SQL back some of its other features in the form of inserted queries such as array e.g.

  class A {$ property_a; $ Property_b; $ Property_c; $ Property_d; Function queries () {$ queries = array (); $ Queries [] = "Include in xxx values" $ This- & gt; Property_A ",". $ This- & gt; Property_b "; $ queries [] =" include in yyy VALUES ". $ $ This-> property_b.", ". $ $ This- & gt; property_d"; }}  

I have a similar function similar to Class B, which does the same thing for the properties of Class B, while still wanting to maintain value from Class A Are there. The query will be passed through the final work at the same time i.e. all, namely:

  $ mysqli-> Query ("Start Transaction"); Foreign currency ($ query as query $) {if (! $ Mysqli ($ query)) {$ mysqli-> Rollback (); }}  

If all is okay $ mysqli-> commit ();

What would be the easiest way to achieve this? Thank you for any advice and ideas!

B :: Within the questions () you can call the implementation of that method and attach it For your data array: Question () returns

A protected $ property_e = 5 in class B; Public Function Question () {$ queries = parent :: queries (); // In an actual application, property_A should be cleaned / first before mixing in SXL Statement / should run first. $ Queries [] = "include in zzz VALUES" $ this- & gt; Property_e; $ Asks; }} $ B = new B; Foreign exchange ($ b-> queries (in the form of $ q) {echo $ q, "\ n";}

But you (also) check an ORM library Such as.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -