mysql:
create database db_student
use db_student
DROP TABLE IF EXISTS `tb_student`;
CREATE TABLE `tb_student` (
`stuId` int(11) NOT NULL AUTO_INCREMENT,
`stuNo` varchar(20) DEFAULT NULL,
`stuName` varchar(255) DEFAULT NULL,
`stuSex` varchar(255) DEFAULT NULL,
`stuCardId` varchar(255) DEFAULT NULL,
`stuPhoneNo` varchar(255) DEFAULT NULL,
`stuAddress` varchar(255) DEFAULT NULL,
PRIMARY KEY (`stuId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#--
#学生信息表
#--
INSERT INTO `tb_student` VALUES ('1', '201451002', '赵翔', '男', '1920170191', '15639272063', '广东省广州市');
INSERT INTO `tb_student` VALUES ('4', '201451003', '简杰福', '男', '1920170183', '15903651569', '广东省广州市');
delete from tb_student where stuId=4
update tb_student set stuNo='125425255',stuName='lisi',stuSex='male',stuAddress='zg456' where stuId=3
#drop table tb_student
select * from tb_student
------------------------------------------------------
mysqlstr.php:
<?php
$server="localhost";
$uid="root";
$pwd="root";
$database="db_student";
$port="3306";
------------------------------------------------------
index.php:
<?php
include("mysqlstr.php");
#1、链接数据库方式
#写法一
//$mycon=mysqli_connect($server,$uid,$pwd,$database,$port);
#学法二
/*$mycon2=mysqli_connect($server,$uid,$pwd);
$db=mysqli_select_db($mycon2,$database);
print_r($db);*/
#写法三
/*$mysqli=new mysqli($server,$uid,$pwd,$database,$port);
print_r($mysqli);*/
#2、执行sql语句:执行sql语句的增删改查操作
#插入数据
/*$mycon2=mysqli_connect($server,$uid,$pwd);