Blogger Information
Blog 63
fans 1
comment 0
visits 76053
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
将电影网站的内容全部用数据库来进行管理
桃儿的博客
Original
1717 people have browsed it

将电影网站的内容全部用数据库来进行管理

实例

<?php
// 连接数据库:$pdo
require 'connect.php';


// 获取网站配置信息(SEO)
$sql = 'SELECT * FROM `system` LIMIT 1';
$stmt = $pdo->prepare($sql);
$stmt->execute();
$system = $stmt->fetch(PDO::FETCH_ASSOC);


// 获取栏目信息
$sql = 'SELECT `cate_id`,`name`,`alias` FROM `category`';
$stmt = $pdo->prepare($sql);
$stmt->execute();
$cates = $stmt->fetchAll(PDO::FETCH_ASSOC);
$cate_count = count($cates);    // 栏目数量


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

?>

运行实例 »

点击 "运行实例" 按钮查看在线实例


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