<?php 
class Comemt_mod  extends HC_Controller
{
	public function __construct()
	{
		parent::__construct();
		if(empty($this -> db)){
			$this -> load_db();
		}
	}
	
	function get_comemt( $id = '', $Num = 10 , $type = 'pro')
	{

		if($id !='' and $Num !='' and $type !='')
		{
			$addsql = " AND com_value_id = ".$id." AND com_type = '".$type."' " ; 
			
			$sqlQuery = " SELECT com_id, com_type , com_value_id ,com_nick_name,com_content, com_add_time,com_ip  FROM  ".$this -> db -> prefix."comment   WHERE  com_enabled = 1  $addsql  GROUP BY  com_id ORDER BY  com_add_time DESC ,`com_id` DESC  LIMIT  0 , $Num ";
			$info 		= $this -> db ->  select_info( $sqlQuery );
			//var_dump($info);
			if( $GLOBALS["WebConfig"]["webhtml"] == 1 )
			{
				foreach((array)$info as $dkey => $dval )
				{
					 
					$info[$dkey]["get_url"] = $this -> buildUrl( $valid = $dval["com_value_id"],$dval["com_type"]);	
				}
				
			}else{
				foreach((array)$info as $dkey => $dval )
				{
					 
					$info[$dkey]["get_url"] = $this -> buildUrl( $valid = $dval["com_value_id"],$dval["com_type"]);	
				}
			}
			return $info;
		}
	}

} 