[PHP与MySQL]①②--文章详情页

Paste_Image.png

article.show.php

<?php 
    require_once('connect.php');
    $id = intval($_GET['id']);
    $sql = "select * from article where id=$id";
    $query = mysql_query($sql);
    if($query&&mysql_num_rows($query)){
        $row = mysql_fetch_assoc($query);
    }else{
        echo "这篇文章不存在";
        exit;
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>文章发布系统</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
<!-- start header -->
<div id="header">
    <div id="logo">
        <h1><a href="#">php与mysql<sup></sup></a></h1>
        <h2></h2>
    </div>
    <div id="menu">
        <ul>
            <li class="active"><a href="#">文章</a></li>
            <li><a href="#">关于我们</a></li>
            <li><a href="#">联系我们</a></li>
        </ul>
    </div>
</div>
<!-- end header -->
</div>

<!-- start page -->
<div id="page">
    <!-- start content -->
    <div id="content">
        <div class="post">
            <h1 class="title"><!--文章标题放置到这里--><?php echo $row['title']?><span style="color:#ccc;font-size:14px;">  作者:<!--作者放置到这里--><?php echo $row['author'];?></span></h1>
            <div class="entry">
                <!--文章内容放置到这里-->
                <?php echo $row['content']?>
            </div>
        </div>
    </div>
    <!-- end content -->
    <!-- start sidebar -->
    <div id="sidebar">
        <ul>
            <li id="search">
                <h2><b class="text1">Search</b></h2>
                <form method="get" action="">
                    <fieldset>
                    <input type="text" id="s" name="s" value="" />
                    <input type="submit" id="x" value="Search" />
                    </fieldset>
                </form>
            </li>
        </ul>
    </div>
    <!-- end sidebar -->
    <div style="clear: both;">&nbsp;</div>
</div>
<!-- end page -->
<!-- start footer -->
<div id="footer">
    <p id="legal"></p>
</div>
<!-- end footer -->
</body>
</html>
Paste_Image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容