PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am using php 5.3. If you are not familiar with late static bindings please be advised this post involves late static bindings.
The functions below will successfully create variables based on the database fields associated with the class.
What I need the construction function to do is to make the variables static when it creates them.
*** Product Class ***
class Product extends Common {
protected static $table_name = 'products';
protected static $db_fields;
public function __construct(){
self::construction ();
}
}
$product = new Product;
class Common {
protected function construction () {
$this->db_fields = self::find_table_fields();
foreach($this->db_fields as $key => $field){
$this->$field = "";
}
}
}