1 Create database table:
Copy code The code is as follows:
create database club;
create table member(
id int(11) not null auto_increment,
no varchar(5) not null,
name varchar(10) not null,
age int(2) not null,
level varchar(10) not null,
sex tinyint(1) not null,
date datetime not null,
primary key(id)
)engine=MyISAM default charset=GB2312;
insert into member(id,no,name,age,level,sex,date)values
(1,'A001','wanxia',30,'hj',1,'2008-04-02 00 :00:00'),
(2,'C022','liyan',29,'zs',1,'2007-05-31 00:00:00'),
(3,' A006','zhangyan',36,'hj',1,'2007-06-20 00:00:00'),
(4,'B052','luanying',42,'bj',1 ,'2007-02-12 00:00:00'),
(5,'A007','duxiang',26,'hj',2,'2008-03-26 00:00:00') ,
(6,'C060','liuyu',38,'zs',1,'2008-10-16 00:00:00');
2 Read data 2.1 Create 01.php
Code
Copy code The code is as follows:
< ;title>Member List
$link=mysql_connect("localhost","root","123"); //Connect to mysql Server
$db=mysql_select_db("club"); //Select database
mysql_query("set names utf8",$link); //Set encoding method
$sql="Select * from member ";
$result=mysql_query($sql,$link); //Execute select query
$num=mysql_num_rows($result); //Get record query
?>
< body>
Fitness Club Member List
Click on the name to view the member's details, existing membersPeople.
if($num>0)
{
?>
}
else
{
echo "The club has not yet developed members.";
}
?>