<?
class CL_COMMENTS{
	public $classname = "cl_comments";
	private $id_comm;
	private $id_owner;
	private $id_comm_type;
	private $id_subject;
	private $comment;
	private $query;
	private $deb_comment = 1;
	private $rsc;
	private $ans;
//	private $table;
//	private $column;

	public function cl_comments( $id_comm = NULL, $id_subject = NULL, $id_owner = NULL, $id_comm_type = NULL, $comment = "" ){
		$this->deb_comment == 1?	$echostr = "class $this->classname:cl_comments()\n" : $echostr= "" ;
		echo  $echostr;

		$this->id_comm = $id_comm;
		$this->id_owner = $id_owner;
		$this->id_subject = $id_subject;
		$this->id_comm_type = $id_comm_type;
		$this->comment = $comment;
	}
	public function read_comment(){
		$this->deb_comment == 1?	$echostr = "class $this->classname:read_comment()\n" : $echostr= "" ;
		echo  $echostr;
		$this->cond = "id='6'";
		$this->query = "SELECT * FROM COMMENTS WHERE $this->cond";
		$q = new CL_QUERY( $this->query, "row" );
		$q->select();
		$rsc = $q->get_rsc();
		print_r( $rsc ); 
		print_r( mysql_fetch_row( $rsc ) ); 
		//print_r( mysql_fetch_row( $q->get_rsc() ) );
		/*if(  $q->get_num_rows()  == 1){
			$a = mysql_fetch_object( $q->get_rsc() ) or cl_log::mydie("fetch_object_error: ". mysql_error(), "db error") ;
		//	var_dump( $a );
		} else{
			cl_log::mydie( "$this->classname: read_comment error: cant fetch object", "db error" );
		}*/

	}
	public function add_comment(){
		$o = new CL_QUERY( "INSERT INTO COMMENTS( id_owner, id_subject, id_comm_type,value) VALUES( '$this->id_owner', '$this->id_subject', '$this->id_comm_type', '$this->comment')" );
		$o->insert();
	}
	public function unset_valid_comment(){

	}
}
?>

