<?php
session_start();
?>
<?php
include ('dbf.php');
include ('classhead.php');
class search {
function print1($head,$ar1,$ar2,$c_ar1,$c_ar2,$tab,$width,$s_f,$s,$page,$id,$se,$where,$c){
 			 $return="<table border='0'  width='".$width."' >";
 			  $return.="<tr><td align='center'><span class='blacktext'><b>$_SESSION[city]<b/></td></tr>";
			  $return.="<tr><td align='center'><a onClick='back(\"getajax.php\")' style='text-decoration:none'><span class='blacktext'><b>$head<b/></span></a></td></tr>";
				$return.="<tr ><td  >";
								$return.="<table border='1' align='center' cellspacing='0.75' cellpadding='3' dir='rtl'  ><tr align='center'>";
										$return.="<td><span class='blacktext'><b>ردیف</b></span></td>";
									for($i=0;$i<$c_ar1;$i++)
										$return.="<td><span class='blacktext'><b>".$ar1[$i]."</b></span></td>";
									$return.="</tr>";
							 if($tab=='dio'){
							 	if($s_f!="")
							     	$fg=mysql_query("select * from $tab where  ($s_f LIKE'%{$s}%') order by $tab.$id ");
								 else
							     	$fg=mysql_query("select * from $tab  order by $tab.$id ");
							 	}
							 elseif(($tab=='matn') && ($se=='1')){
							 	$fg=mysql_query("select * from $tab  $where ");
							 	}
							 elseif(($tab=='ketab') && ($se=='2')){
									$fg=mysql_query("select * from $tab $where ");
							 }
							 elseif($tab=='amanat'){
							 		if($c=='0')
							 			$fg=mysql_query("select * from amanat where (date_in=0 and city='{$_SESSION[city]}') order by amanat.id_ozv");
							 		elseif($c=='1')
										$fg=mysql_query("select * from amanat where (city='{$_SESSION[city]}') order by amanat.id_ozv");
							 		elseif($c=='2')
										$fg=mysql_query("select * from amanat where ( city='{$_SESSION[city]}') order by amanat.id_ozv");
							 		elseif($c=='3')
										$fg=mysql_query("select * from amanat where ( city='{$_SESSION[city]}') order by amanat.id_ozv");
							  		elseif($c=='4')
							 			$fg=mysql_query("select * from amanat where (($s_f LIKE'%{$s}%') and date_in=0 and city='{$_SESSION[city]}') order by amanat.id_ozv")or die(mysql_error());

							 }else{
							 	if($s_f!="")
							     	$fg=mysql_query("select * from $tab where (city='{$_SESSION[city]}' and ($s_f LIKE'%{$s}%') ) order by $tab.$id ");
							 	else
							     	$fg=mysql_query("select * from $tab where (city='{$_SESSION[city]}' )  ");
							 	}

							 $k=1;
							 while($v=mysql_fetch_assoc($fg)){
							 	if($tab=='matn'){
							 		$gg=mysql_query("select * from ketab where (id='{$v['id']}')");
									$vj=mysql_fetch_assoc($gg);
									}
								elseif(($tab=='ketab') && ($se=='1')){
									$gg=mysql_query("select * from ketab where (ketab.id='{$v['id']}') order by ketab.name)");
									$vj=mysql_fetch_assoc($gg);
									}
								  $return.="<tr align='center'>";
 								  	   $return.="<td><span class:blackText>".$k."</span></td>";
								   for($j=0;$j<$c_ar2;$j++){
 								  	   if($tab=='matn' && $j=='1')
 								  	   		$return.="<td><span class:blackText>".$vj[$ar2[$j]]."</span></td>";
 								  	   else
 								  	   		$return.="<td><span class:blackText>".$v[$ar2[$j]]."</span></td>";

										}
								  $return.="</tr>";
								  $k++;
								}
							$return.="</table>";
				$return.="</td></tr></table>";
	return $return;
}

}
?>