【php开源代码栏目提醒】:网学会员在php开源代码频道为大家收集整理了showarticle.php提供大家参考,希望对大家有所帮助!
<?php
include('head.php');
require_once('com/db.php');
$db = new DataAccess();
$db->connect();
?>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css.css" type="text/css">
<title></title>
</head>
<body>
<div align="center">
<table border="0" width="760" cellspacing="0" cellpadding="0" id="table1" height="206">
<tr>
<td style="border-left: 1px solid #0086DF; border-right: 1px solid #0086DF" width="760" valign="top">
<div align="center">
<table border="0" width="99%" cellspacing="0" cellpadding="0" id="table2" height="205">
<tr>
<td width="206" valign="top" align="center">
<table border="0" width="87%" cellspacing="0" cellpadding="0" id="table3">
<tr>
<td height="36" style="border-top:1px solid #D4D4D4; border-left:1px solid #D4D4D4; border-right:1px solid #D4D4D4; border-bottom-width: 1px">
<img border="0" src="images/article.gif" width="192" height="41"></td>
</tr>
<tr>
<td height="36" style="border-left: 1px solid #D4D4D4; border-right: 1px solid #D4D4D4; border-top-width: 1px; border-bottom-width: 1px">
<table border="0" width="95%" cellspacing="0" cellpadding="0" height="25" id="table11">
<form name='form1' method="POST" action="searcharticle.php" TARGET="_blank">
<tr>
<td height="30">
<p align="left">
<select size="1" name="articletype">
<option value="1">新闻动态</option>
<option value="2">求职技巧</option>
</select></td>
</tr>
<tr>
<td height="30">
<p align="left">
<select size="1" name="how">
<option selected value="1">按文章标题
</option>
<option value="2">按文章内容</option>
</select></td>
</tr>
<tr>
<td height="30">
<input onfocus="this.value=''" type="text" name="what" size="20" style="border-style: solid; border-width: 1px" value="关键字"></td>
</tr>
<tr>
<td height="30">
<p align="center">
<input border="0" src="images/s2.gif" name="I1" width="53" height="20" type="image"></td>
</tr>
</form>
</table>
</td>
</tr>
<tr>
<td height="36" style="border-top:1px solid #D4D4D4; border-left:1px solid #D4D4D4; border-right:1px solid #D4D4D4; ">
<img border="0" src="images/article2.gif" width="192" height="41"></td>
</tr>
<tr>
<td height="36" style="border-bottom:1px solid #D4D4D4; border-left:1px solid #D4D4D4; border-right:1px solid #D4D4D4; border-top-width: 1px; " valign="top">
<div align="center">
<table border="0" width="94%" cellspacing="0" cellpadding="0" id="table13" height="25">
<?php
//新闻
$sql = "select id,title,content,writer,addtime from article order by click desc";
$result = $db->query($sql);
$row_num = $db->getRowNum();
if($row_num <= 0)
echo "暂时没有新闻!";
else
{
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
?>
<tr>
<td height="18">
<a target="_blank" href="showarticle.php?id=<?php echo $row['id']; ?>">
<?php echo $row['title']; ?></a></td>
</tr>
<?php
}
}
?>
</table>
</div>
</td> </tr>
</table>
</td>
<td valign="top">
<div align="center">
<table border="0" width="99%" cellspacing="0" cellpadding="0" id="table14" height="197">
<tr>
<td height="46" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0; border-top: 1px solid #C0C0C0; border-bottom-width: 1px" width="540" background="images/bg2.gif">
<table border="0" width="537" cellspacing="0" cellpadding="0" id="table15" height="30">
<tr>
<td valign="bottom" width="110">
</td>
<td width="427">
<p align="center"><b><font size="4" color="#000080"><? echo $row['title'];?></font></b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="border-bottom:1px solid #C0C0C0; border-left:1px solid #C0C0C0; border-right:1px solid #C0C0C0; border-top-width: 1px" valign="top" align="center">
<table border="0" width="96%" cellspacing="0" cellpadding="0" id="table16" height="107">
<?php
//新闻
$
sql = "select id,title,content,writer,addtime,click from article where id = '".$_GET['id']."' order by click desc";
$result = $db->query($sql);
$row_num = $db->getRowNum();
if($row_num <= 0)
echo "暂时没有新闻!";
else
{
$db1 = new DataAccess();
$db1->connect();
$sql = "update article set click=click+1 where id = '$id'";
$result1 = $db1->perform($sql);
if(!$result1)
echo '更新点击数出错!';
while($row =
mysql_fetch_array($result,MYSQL_ASSOC))
{
?>
<tr>
<td height="25"><?php echo $row['title']; ?></td>
</tr>
<tr>
<td style="line-height: 15