<?php
/*
* All copyright reserved (c) 2004-2010 by Gohappy
* Designer:Gohappy
*/
$root_path='.';
include_once($root_path.'/php/connect_sub.php');
include_once($root_path.'/php/sub.php');
include_once($root_path.'/php/page_sub_new.php');
include_once($root_path.'/php/top_bottom.php');

$insearch=$searchkey;

if($insearch!='')
{
	$search_sql="and (ztitle like \"%$insearch%\" or ftiltle like \"%$insearch%\" or ftiltle2 like \"%$insearch%\" or note like \"%$insearch%\"  ) ";

	$result	=	$db->query("SELECT nid,ztitle,addtime,qid,bid from {$db_sux}papers_news where nid $search_sql ORDER BY addtime DESC ");
	$search_num=$db->num_rows($result);		$total_num=$total_num+$search_num;
  if($search_num > 0)
  {
	$fgfg	.=	'<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="100%" height="28" background="/images/bg_005.gif" align="left">&nbsp;<span  class="s04 f14">找到 '.$search_num.' 条结果</span></td>
       </tr>
        <tr>
          <td height="1" colspan="2" bgcolor="#549bcb"></td>
        </tr>
        </table>       
      <table width="743" border="0" cellspacing="0" cellpadding="0">
      '; 
	while($gb = $db->fetch_array($result))
	{
		//多少期
		$gb_qi=$db->fetch_array($db->query("SELECT * from {$db_sux}papers where qid='$gb[qid]' "));
		
		$gb_ban=$db->fetch_array($db->query("SELECT * from {$db_sux}papers_ban where bid='$gb[bid]' "));

		//替换类别
		$temp_href='/News/Newspaper_html_info.php?inid='.$gb['nid'];
		$fgfg	.='<tr>
  			<td width="10%" height="25" align="left">'.substr($gb_qi[addtime],0,10).'</td>
  			<td width="90%" align="left"><a href="/bao/info.php?inid='.$gb[qid].'&ban='.$gb_ban[bnum].'" target="_blank"  class="title05">[第'.$gb_qi[z_qi].'期 第'.$gb_ban[bnum].'版]</a>&nbsp;<a href="/bao/info.php?inid='.$gb[qid].'&ban='.$gb_ban[bnum].'" target="_blank"  >'.$gb[ztitle].'</a></td>
  			</tr>
  			<tr>
  				<td colspan="2" height="1" background="/images/di_01.gif"></td>
  			</tr>';
  }      
	$fgfg	.='</table><br><br>';
	}
	else
	{
		$fgfg='抱歉！没有找到和"'.$searchkey.'"相关的结果';
	}
}
	
$list_html=$fgfg;

include(parse_template('search'.'_g',$root_path.'/tpl/bao/',$root_path.'/'));
?>