php + mysql 調用數據庫內容 =》 簡介

1. php 代碼    =》index.php


<?php include "conn.php" ;?>



<html>
 
  <body>
 
 
   <?php
                                            $result=  mysql_query("select * from jianjie where id=3 order by id desc");
                                            while($row=  mysql_fetch_array($result)){
                                            ?>
    <p>
    
     <?php echo $row["neirong"]  ; ?>
    
    
    
    </p>
    <?php
    
    }
    ?>
   
 
  </body>


</html>

----------------------***************-------------------------************----------------


2. 數據庫配置

<?php



$mysql = mysql_connect("localhost","root","root");
mysql_select_db("ceshi_jianjie");
mysql_query("set names UTF8");

 
date_default_timezone_set("PRC");

 



?>

-------------------------****************--------------------------***************-----------------------


3.數據庫 =》   ceshi_jianjie.sql


/*
Navicat MySQL Data Transfer

Source Server         : root
Source Server Version : 50540
Source Host           : localhost:3306
Source Database       : ceshi

Target Server Type    : MYSQL
Target Server Version : 50540
File Encoding         : 65001

Date: 2015-12-12 02:44:04
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for jianjie
-- ----------------------------
DROP TABLE IF EXISTS `jianjie`;
CREATE TABLE `jianjie` (
  `id` int(8) DEFAULT NULL,
  `neirong` text COMMENT '內容=》 簡介'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of jianjie
-- ----------------------------
INSERT INTO `jianjie` VALUES ('2', '222');
INSERT INTO `jianjie` VALUES ('3', '333');
INSERT INTO `jianjie` VALUES ('5', '555');

-- ----------------------------
-- Table structure for list
-- ----------------------------
DROP TABLE IF EXISTS `list`;
CREATE TABLE `list` (
  `id` int(8) DEFAULT NULL,
  `neirong` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of list
-- ----------------------------
INSERT INTO `list` VALUES ('1', '111');
INSERT INTO `list` VALUES ('2', '22');
INSERT INTO `list` VALUES ('3', '333');
INSERT INTO `list` VALUES ('4', '444');
INSERT INTO `list` VALUES ('5', '555');
INSERT INTO `list` VALUES ('6', '666');

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int(8) DEFAULT NULL,
  `name` varchar(12) DEFAULT NULL,
  `list` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', '1', '1');

--------------------*****************------------------*****************---------------

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章