public function add_fields($tablename = null, $table_structure = null)
    {
        if (empty($tablename) || empty($table_structure)) return false;

        if (!is_string($table_structure))
            $table_structure_ar = self::build_fields_array( $table_structure );
        else
            $table_structure_ar = array($table_structure);

        if (self::table_exists($tablename)) {
            $query = "ALTER TABLE $tablename ADD COLUMN ( ".join(',', $table_structure_ar)." );";
    /*
            $this->queries[] = $query;
            $results = $this->db->queryExec($query, $err);
            if ($err) trigger_error( "Can not alter table '$tablename' [$err]!", E_USER_ERROR );
    */
            $results = $this->query($query, null, 'queryExec');
            $this->addCachedQuery( $query );
        }
        return true;
    }
public function add_fields($tablename = null, $table_structure = null)
    {
        if (empty($tablename) || empty($table_structure)) return false;

        if (!is_string($table_structure))
            $table_structure_ar = self::build_fields_array( $table_structure );
        else
            $table_structure_ar = array($table_structure);

        if (self::table_exists($tablename)) {
            $query = "ALTER TABLE $tablename ADD COLUMN ( ".join(',', $table_structure_ar)." );";
    /*
            $this->queries[] = $query;
            $results = $this->db->queryExec($query, $err);
            if ($err) trigger_error( "Can not alter table '$tablename' [$err]!", E_USER_ERROR );
    */
            $results = $this->query($query, null, 'queryExec');
            $this->addCachedQuery( $query );
        }
        return true;
    }
public function add_fields ( $ tablename = null , $ table_structure = null ) { if ( empty ( $ tablename ) || empty ( $ table_structure ) ) return false ; if ( ! is_string ( $ table_structure ) ) $ table_structure_ar = self :: build_fields_array ( $ table_structure ) ; else $ table_structure_ar = array ( $ table_structure ) ; if ( self :: table_exists ( $ tablename ) ) { $ query = "ALTER TABLE $tablename ADD COLUMN ( " . join ( ',' , $ table_structure_ar ) . " );" ; /*
            $this->queries[] = $query;
            $results = $this->db->queryExec($query, $err);
            if ($err) trigger_error( "Can not alter table '$tablename' [$err]!", E_USER_ERROR );
    */ $ results = $ this -> query ( $ query , null , 'queryExec' ) ; $ this -> addCachedQuery ( $ query ) ; } return true ; }
Add fields in a table

@param string $tablename The new table name
@param array $table_structure An array of the table fields
@return bool TRUE if the field had been added, FALSE if an error occurred
Add fields in a table