时间:2021-07-01 10:21:17 帮助过:16人阅读
我的BBB.php文件:
1 <?php 2 return $config=array( 3 ‘host‘=>"localhost", 4 ‘user‘=>"root", 5 ‘pwd‘=>"root", 6 ‘dbname‘=>"thkphp5", 7 ‘sql‘=>$sql);
我的login.html文件:
1 <!-- 模板文件,利用HTML代码展示数据 --> 2 <!DOCTYPE html> 3 <html lang="en"> 4 <head> 5 <meta charset="UTF-8"> 6 <title>比赛列表</title> 7 </head> 8 <body> 9 10 <table> 11 <tr> 12 <th>ZX_id</th> 13 <th>ZX_name</th> 14 <!--<th>ZX_fenlei</th>--> 15 <!--<th>ZX_zuozhe</th>--> 16 <!--<th>更新时间</th>--> 17 <!--<th>浏览次数</th>--> 18 <!--<th>发布状态</th>--> 19 </tr> 20 <?php foreach($shujuku->result as $row) : ?> 21 <tr> 22 <td><?php echo $row[0];?></td> 23 <td><?php echo $row[1];?></td> 24 <!--<td><?php echo $row[2];?></td>--> 25 <!--<td><?php echo $row[3];?></td>--> 26 <!--<td><?php echo $row[4];?></td>--> 27 <!--<td><?php echo $row[5];?></td>--> 28 <!--<td><?php echo $row[6];?></td>--> 29 </tr> 30 <?php endForeach;?> 31 </table> 32 </body> 33 </html>
结果展示:
我的数据库代码:
1 CREATE DATABASE `thkphp5` ; 2 use thkphp5 ; 3 create table zixun( 4 ZX_id int not null auto_increment primary key comment ‘咨询ID号‘, 5 ZX_name VARCHAR(80) NOT NULL COMMENT ‘咨询标题‘, 6 ZX_fenlei varchar(80) not null comment ‘资讯分类‘, 7 ZX_zuozhe varchar(80) not null comment ‘资讯作者‘, 8 gengxin_time DATETIME NOT NULL DEFAULT ‘2016-01-01 01:01:01‘ COMMENT ‘更新时间‘, 9 liulan_cishu int NOT NULL COMMENT ‘浏览次数‘, 10 fabu_zhuangtai VARCHAR(50) NOT NULL COMMENT ‘发布状态‘ 11 )engine=MyISAM charset=utf8; 12 INSERT into zixun(ZX_id, ZX_name, ZX_fenlei, ZX_zuozhe, gengxin_time, liulan_cishu, fabu_zhuangtai) values(10001, ‘PHP‘, ‘理论‘, ‘王超‘, ‘2017-08-07 11:58:01‘, 100, ‘草稿‘); 13 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10002,‘C语言‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 14 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10003,‘JAVA语言‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 15 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10004,‘Mysql语言‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 16 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10005,‘html‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 17 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10006,‘spring‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 18 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10007,‘scence‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 19 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10008,‘computer‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 20 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10009,‘math‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 21 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(100010,‘english‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 22 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10011,‘word‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 23 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10012,‘jsp‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘); 24 INSERT into zixun(ZX_id,ZX_name,ZX_fenlei,ZX_zuozhe,gengxin_time,liulan_cishu,fabu_zhuangtai) values(10013,‘CSS‘,‘理论‘,‘王超‘,‘2017-08-07 11:58:01‘,100,‘草稿‘);
39)PHP,选取数据库中的两列
标签:alt comment 时间 log arc 使用 val 理论 doc