(C)Erik Bernoth aka sholvar class channel { var $tid, $title, $descript, $items, $opt_top, $opt_pla, $opt_tim; // constructor function channel ($id=0) { if ($id > 0) $this->get($id); else { $this->tid = 0; $this->title = ''; $this->descript = ''; $this->opt_top = ''; $this->opt_pla = ''; $this->opt_tim = ''; } } // load dataset function get($id) { // global $global_db_dbname; // // @mysql_pconnect($global_db_dbname); // $result = @mysql_db_query("dbname","SELECT * FROM Channel WHERE tid=$id"); // if ($row = @mysql_fetch_row($result)) // { // $this->tid = $row[0]; // $this->title = $row[1]; // $this->descript =$row[2]; // $this->opt_top = $row[3]; // $this->opt_pla = $row[4]; // $this->opt_tim = $row[5]; // $this->items = getItems($this->opt_top, $this->opt_pla, $this->opt_tim); // }//e.o.if fetch $this->tid = $id; $this->opt_pla = 'all'; $this->opt_tim = 4; $this->title='shols blog'.$id; $this->descript = 'Blog von shol.net. id ist '.tid; }//e.o. get() // write dataset function set() { global $global_db_dbname; if ($this->tid > 0) { // ein UPDATE @mysql_pconnect($global_db_dbname); $result = @mysql_db_query("dbname","UPDATE Channel SET title='$this->title', descript='$this->descript', opt_top='$this->opt_top', opt_pla='$this->opt_pla', opt_tim='$this->opt_tim' WHERE tid=$this->tid"); }else{ // ein INSERT @mysql_pconnect($global_db_dbname); $result = @mysql_db_query("dbname","INSERT INTO Channel SET title='$this->title', descript='$this->descript', opt_top='$this->opt_top', opt_pla='$this->opt_pla', opt_tim='$this->opt_tim' )"); $this->tid = @mysql_insert_id(); } } } // end of class