大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> PHP专区 -> 新闻分类录入、显示系统

新闻分类录入、显示系统

时间: 2021-07-31 作者:daque

本体例不妨录入题目、实质、图片、关系软硬件,表露时会按照能否有有图片和关系软硬件来确定能否表露该项实质,翻开页面表露的是最新的一片作品,点击目次会表露之前的作品。     创造channelimages和channelsoft目次,并把权力设为777。 ********************************* news表构造 ********************************* # host: localhost database : yourdb # -------------------------------------------------------- # # table structure for table 'yourtable' # create table news(    id int(11) default '0' not null auto_increment,    kind varchar(16),    title varchar(60),    content text,    pic varchar(30),    timer datetime default '0000-00-00 00:00:00' not null,    soft varchar(30),    primary key (id),    key timer (timer) ); ********************************* 消息录入文献:insert.htm ********************************* <html> <head> <title>消息录入</title> <meta http-equiv="content-type" content="text/html; charset=utf8"> </head> <body bgcolor="#ffffff"> <form name="form1" enctype="multipart/form-data" action="insert.php" method="post" >   <table width="81%" border="0" cellspacing="2" cellpadding="0" align="center">     <tr>        <td width="11%" align="right" bgcolor="#cc0000"><font color="#ffffff">题目:</font></td>       <td bgcolor="#e7e7e7">          <input type="text" name="title" size="60">       </td>     </tr>     <tr>        <td align="right" bgcolor="#cc0000"><font color="#ffffff">类型:</font></td>       <td bgcolor="#e7e7e7">          <input type="radio" name="kind" value="典型1">         典型1          <input type="radio" name="kind" value="典型2">         典型2         <input type="radio" name="kind" value="典型3">         典型3         <input type="radio" name="kind" value="典型4">         典型4</td>     </tr>     <tr>        <td width="11%" align="right" bgcolor="#cc0000"><font color="#ffffff">实质:</font></td>       <td bgcolor="#e7e7e7">          <textarea name="content" cols="60" rows="10"></textarea>       </td>     </tr>     <tr>        <td width="11%" align="right" bgcolor="#cc0000"><font color="#ffffff">图片:</font></td>       <td bgcolor="#e7e7e7">          <input type="file" name="pic" size="60">       </td>     </tr>     <tr>        <td width="11%" align="right" bgcolor="#cc0000"><font color="#ffffff">软硬件:</font></td>       <td bgcolor="#e7e7e7">          <input type="file" name="soft" size="60">       </td>     </tr>     <tr>        <td width="11%" align="right" bgcolor="#cc0000"> </td>       <td bgcolor="#e7e7e7">          <div align="center">            <input type="submit" name="submit" value="提 交">         </div>       </td>     </tr>   </table> </form> </body>  </html>  ********************************* end of insert.htm ********************************* ********************************* insert.php ********************************* <? $day=date("md"); if($pic != "none"){ $picname=$day.$pic_name; copy($pic,"channelimages/$picname"); unlink($pic); } if($soft!= "none"){ copy($soft,"channelsoft/$soft_name"); unlink($soft); } $dbh =  mysql_connect('localhost','uesrname','passward'); mysql_select_db('yourtable');  $dat=date("y-m-d h:i:s"); $query="insert into news(title,kind,content,pic,timer,soft) values('$title','$kind','$content','$picname',now(),'$soft_name')"; $res = mysql_query($query,$dbh);  $err = mysql_error(); if($err){echo $err;exit();} echo "<p></p><p align=center>"; echo "<body><h2>录入胜利</h2></body></p>"; ?> ********************************* end of insert.php ********************************* ********************************* 消息表露文献:news.php ********************************* <html> <head> <title>表露典型1</title> <meta http-equiv="目次典型" content="文本/html; 字符集=gb2312"> </head> <body bgcolor="#ffffff"> <? $db=mysql_connect("localhost","username","passward"); mysql_select_db("yourtable",$db); $result=mysql_query("select id,title from news where kind='典型1' order by timer desc"); for($a=0;$a<10;$a++) {if(!($ahrow=mysql_fetch_row($result)))break; $id=mysql_result($result,$a,"id"); $title=mysql_result($result,$a,"title"); echo "<a href=news.php?id=".$id.">".$title."</a><br>"; } if (!isset($id)) $id=mysql_result($result1,0,"id"); $result=mysql_query("select * from news where id=$id order by timer desc"); $rows=mysql_fetch_row($result); echo "<br><center><font color=ff0000>"; print $rows[2]; echo "</font><br>$rows[5]</center>"; if (strlen($rows[4])>0) echo "<p><img src=channelimages/$rows[4] align=right>"; echo str_replace("\r","<br>",str_replace(" "," ",$rows[3])); if (strlen($rows[6])>0) echo "</p><p align=right><a href=channelsoft/$rows[6]>>>点击载入</a></p>"; ?> </body> </html> ********************************* end of news.php ********************************* 【正文版权归作家与奥索网共通具有,如需连载,请证明作家及根源】    

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.