Home > php教程 > php手册 > PHP5与MySQL数据库操作常用代码 收集

PHP5与MySQL数据库操作常用代码 收集

WBOY
Release: 2016-06-06 20:33:20
Original
1164 people have browsed it

php最近比较热门,所以学习php的朋友也越来越多,这里整理下数据库的一些操作,需要的朋友可以参考下。

1 建立数据库表:
代码如下:
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 读取数据
2.1 建立01.php
代码
代码如下:



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template