<?php
include_once "Database.class.php";
class searchList
{
	 private $general;
	 var $searchtable;
	 var $condn;
	 var $searchfld;
	 var $data;
	 var $table;
	 var $checkdata;
	 var $set;
	function __construct()
	{
	
			date_default_timezone_set("Asia/Kolkata");
			$this->now		= date("Y-m-d");
			$this->date		= date("Y-m-d H:i:s");
			$this->db		= new database();
			if(!$this->db->dbConnect())
			die("Error Connection".$this->db->ErrorInfo);
	}
		
	function __destruct()
	{
			@$this->db->dbClose();
	}
	function rowNum()
	{
		$sql="select ".$this->searchfld." from ".$this->searchtable.$this->condn;
		//echo $sql;exit;
		$res	=	mysql_query($sql);
		return mysql_num_rows($res);
	}
	function selectrow()
	{
		 $sql="select ".$this->searchfld." from ".$this->searchtable.$this->condn;
		//echo $sql;echo '<br>';
		$res	=	$this->db->readValues($sql);
		return $res;
	}
	function selectrowJoin()
	{
		 $sql="select ".$this->searchfld." from ".$this->searchtable.$this->condn;
		//echo $sql;exit;
		$res	=	$this->db->readValues($sql);
		return $res;
	}
	function saveData(){
        $this->db->Insert($this->data,$this->table);
    }
    function updateData(){
        $this->db->Update($this->table,$this->set,$this->condn);
    }
	// Adds a record to the database based on the array key names
	function CheckInjection(){
		return($this->db->CheckInjection($this->checkdata));
		}
	
}
function replace_space_withhifen($main_string){

		$val="--";

		$rep_val1=" ";

		if(stristr($main_string,$rep_val1))

		$str=str_replace($rep_val1,$val,$main_string);

		else

		$str=$main_string;

		return $str;

		}
function replace_hifen($urlvalue1){

		$pattern = '/--/';
	
		$replacement = " ";
	
		if(strlen(trim(preg_replace($pattern, $replacement, $urlvalue1)))!=0)  

		{

			$urlvalue1 = preg_replace($pattern, $replacement, $urlvalue1);

		}

		return $urlvalue1;

}

?>