Blogger Information
Blog 26
fans 1
comment 0
visits 19118
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
用数据库管理网站
坏人也温柔de陈词滥调
Original
732 people have browsed it

<?php
// 网站数据来自数据表
// 1 连接数据库
require __DIR__ . '/connect.php';

// 2. 获取影视信息
$sql = 'SELECT `mov_id`, `name`,`image`,`detail`,`cate_id`  FROM `movies`';
$stmt = $pdo-> prepare($sql);
$stmt->execute();
$movies=$stmt->fetchAll(PDO::FETCH_ASSOC);

// 3. 获取栏目信息
$sql = 'SELECT `cate_id`, `name`,`alias`  FROM `category`';
$stmt = $pdo-> prepare($sql);
$stmt->execute();
$cates=$stmt->fetchAll(PDO::FETCH_ASSOC);
//count array length
$cate_count = count($cates);
// 3. 获取网站的配置信息
$sql = 'SELECT *  FROM `system` LIMIT 1';
$stmt = $pdo-> prepare($sql);
$stmt->execute();
$system = $stmt->fetch(PDO::FETCH_ASSOC);

?>
<!doctype html>
<!doctype html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta name="description" content="<?php echo $system['desc'];?>">
   <meta name="keywords" content="<?php echo $system['key'];?>">
   <title><?php echo $system['title'] ?></title>
<!--    <link rel="stylesheet" href="../css/tda.css">-->
   <style>
       .header {
           background-color: #02aaa9;
           height: 30px;
       }

       .nav li {
           list-style:none;
           min-width:80px;
           line-height: 30px;
           float: left;
       }

       .nav li a {
           text-decoration: none;
           color: white;
       }
       .nav {
           overflow: hidden;
       }
       .footer {
           height: 30px;
           background-color: #02aaa9;
           color: #ff0c05;
           text-align: center;
           line-height: 30px;
       }
   </style>
</head>
<body>
<div class="header">
   <ul class="nav">
       <li><a href="../index.php">腾讯</a></li>
       <?php foreach ($cates as $cate): ?>
           <li><a href="list.php?cate_id=<?php echo $cate['cate_id'] ?>"><?php echo $cate['alias'] ?></a></li>
       <?php endforeach; ?>
   </ul>
</div>

微信图片_20190801103450.png

微信图片_20190801103425.png

Correction status:qualified

Teacher's comments:还是补之前的作业呢, 建议之前的作业先放放, 尽可能跟上进度, 否则二头都顾不上, 之前的作业 , 可以放在双休日集中完成
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post