Blogger Information
Blog 47
fans 0
comment 0
visits 21057
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
TP6配置与数据库操作
P粉036614676
Original
656 people have browsed it

1. TP6框架配置

2.数据库操作

2.1增(insert,insertall,insertgetid)

  1. $arr = ['Cno' => 8,'Cname' => '数学','Cpno' => 7, 'Ccredit' => 10];
  2. Db::table('course')->insert($arr);
  1. $arr = [['Cno' => 9,'Cname' => '数学','Cpno' => 7, 'Ccredit' => 10],
  2. ['Cno' => 10,'Cname' => '数学','Cpno' => 2, 'Ccredit' => 10]
  3. ];
  4. Db::table('course')->insertAll($arr);
  1. $arr = ['Cno' => 11,'Cname' => '数学','Cpno' => 7, 'Ccredit' => 10];
  2. $res = Db::table('course')->insertGetId($arr);
  3. echo $res;

2.2删(delete)

  1. $res = Db::table('course')->where('Cno',8)->delete();

2.3查(select,find)

查询一条数据

  1. $res = Db::table('course')->where('Cno','2')->field('Cno')->find();
  2. print_r($res);

查询多条数据

  1. $res = Db::table('course')->where('Cno','2')->find();
  2. print_r($res);

2.4改(update)

  1. $res = Db::table('course')->where('Cno',8)->update($arr);
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post