title: php oop is there way to automatically set this variables
body: <pre><code>class User extends DatabaseObject {
  
      protected static $table_name='users';
      protected static $db_fields = array();
  
  public  function __construct() {
  
      // Get columns from table
      global $database;
      $result_set = $database-&gt;query("SELECT * FROM ".self::$table_name." LIMIT 1");
      $num_fields = mysql_num_fields($result_set);
      for($i=0; $i&lt;$num_fields; $i++) {
          $column_name = mysql_field_name($result_set, $i);
          // Set column names as variables
          self::$db_fields[] = $column_name; // THIS WORKS
      $this-&gt;{$column_name}; // THIS IS PROBLEMATIC!
  
    }
  
  }
  </code></pre>
  
  <p>for example this <code>$name = pulic $wherever;</code>
  so I can call, for example, <code>wherever-&gt;wherever</code>;</p>
  
  <p>so that I don't have to type this name every time I add the variables</p>
  
  <pre><code>public $md5;
  public $credit;
  public $pontaria_time;
  public $Credits;
  public $airoplayne;
  public $city_id;
  public $prisao_time;
  public $crime2;
  public $banck_time;
  </code></pre>