php小白 超市管理系统 知识点总结_php

知识点

1 php跳转的方式 

header('Location:login.php');

php.ini->output_buffering = 4096

<script>window.location.href='http://www.jb51.net';</script>


2 sql语句 

$sql="select * from $table_person where username='".$username."'";

$sql="insert into $table_supplier(snum,sname,uname,uphone,uphone2,btime,dscribe)values('".$providerId."','".$providerName."','".$people."','".$phone."','".$fax."',now(),'".$describe."')";

          $sql="select * from $table_supplier where sname like '%".$search."%'";

          $sql="UPDATE $table_supplier SET sname='".$_POST['providerName']."'"." WHERE snum='".$result['snum']."'";

3 页面中get 请求需要带参数,但参数是数组,可以用json格式化以后

$send2=htmlspecialchars(json_encode($row['snum']));

$result=(array)json_decode($_GET['u']);

4 sql 外键约束的前提是 引擎 为 

set names gbk;
create database db_bill DEFAULT CHARSET gbk;
use db_bill;
create table bill_person (id int primary key auto_increment not null,
username varchar(20) not null,
password varchar(20) not null,
purviex int not null
);
create table bill_supplier (
snum varchar(80) primary key not null,
sname varchar(80) not null,
uname varchar(80) not null,
uphone varchar(80) not null,
uphone2 varchar(80),
btime date,
dscribe varchar(30)
)ENGINE=InnoDB;


create table bill_bill (
bid varchar(30),
name varchar(30) not null,
sname varchar(30) not null,
bmoney int not null,
ispay enum('0','1') not null,
ctime date,
foreign key (bid) references bill_supplier(snum)
)ENGINE=InnoDB;


insert into bill_person (username,password,purviex) values ('admin','admin',1);
insert into bill_person (username,password,purviex) values ('tom','admin',1);


insert into bill_supplier(snum,sname,uname,uphone,btime)values(
'bill007','公司1','路人甲','123123123',now());
insert into bill_supplier(snum,sname,uname,uphone,btime)values(
'bill002','公司2','路人甲2','123123123',now());
insert into bill_supplier(snum,sname,uname,uphone,btime)values(
'bill003','公司3','路人甲3','123123123',now());
insert into bill_supplier(snum,sname,uname,uphone,btime)values(
'bill005','公司4','路人甲4','123123123',now());


insert into bill_bill (bid,name,sname,bmoney,ispay,ctime) values('bill002','清风卫生纸','上海清风集团','12','0',now());


insert into bill_bill (bid,name,sname,bmoney,ispay,ctime) values('bill002','卫生巾','上海清风集团','12','0',now());


insert into bill_bill (bid,name,sname,bmoney,ispay,ctime) values('bill002','牙膏','上海清风集团','12','0',now());