摘要: public function index() { // 查询 全部数据 // $list = db('admin')->select(); // 查询一维数组 // $list1 = db('admin')->where('id',2)->find(); // 增加 // $data = [ // 阅读全文
posted @ 2020-09-17 15:23 梦魇之瞳 阅读(118) 评论(0) 推荐(0) 编辑
摘要: <?php namespace app\admin\controller; use think\Controller; use think\DB; class Index extends Controller { // public function _initialize() // { // if 阅读全文
posted @ 2020-09-17 15:22 梦魇之瞳 阅读(205) 评论(0) 推荐(0) 编辑
摘要: $id = $_COOKIE['admin']; $qwe = new mysqli('localhost', 'root', 'root', 'qwer'); if ($qwe->connect_error) { echo $qwe->connect_error; exit(); } $sqe = 阅读全文
posted @ 2020-08-31 17:25 梦魇之瞳 阅读(126) 评论(0) 推荐(0) 编辑
摘要: $arr = []; // 文件上傳接口PHP if ($_FILES) { if ($_FILES['file']['type'] == 'image/pan' || $_FILES['file']['type'] == 'image/jpg' || $_FILES['file']['type'] 阅读全文
posted @ 2020-08-31 17:24 梦魇之瞳 阅读(140) 评论(0) 推荐(0) 编辑
摘要: // $qwe = new mysqli('localhost','root','root','qwer'); // $pasd = md5(645524); // $wer = "insert into wer (name,pasd) values ('mark','$pasd')"; // $r 阅读全文
posted @ 2020-08-31 17:20 梦魇之瞳 阅读(89) 评论(0) 推荐(0) 编辑
摘要: // 增加,删除,修改 $spl = "insert into student(sname,ssex) values ('小明','男')"; $rest = $conn->query($spl); // 查询 $sqq = "select * from student"; $list = $con 阅读全文
posted @ 2020-08-14 09:51 梦魇之瞳 阅读(93) 评论(0) 推荐(0) 编辑
摘要: // 面向对象,数据库连接 $conn = new mysqli('localhost','root','root','black'); // 判断是否连接 if($conn->connect_error){ echo $conn->connect_error; }else{ echo '连接成功' 阅读全文
posted @ 2020-08-14 09:19 梦魇之瞳 阅读(92) 评论(0) 推荐(0) 编辑
摘要: 1、聚合函数查询:(常用的) min最小值;max最大值;sum值的和;avg平局值;count统计行数 2、分组查询: group by: 根据一个或多个列对结果集进行分组。 表示对所取得的数据,以所给定的字段来进行分组。 最后的结果就是将数据分成了若干组,每组作为一个“整体”成为一行数据。 于是 阅读全文
posted @ 2020-08-07 17:09 梦魇之瞳 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 1、查询数据(重点): 语法: select 字段1,字段2 from 表名 [where Clause][LIMIT N][OFFSET M] ² 查询语句中你可以使用一个或者多个表,表之间使用逗号(,)分割,并使用WHERE语句来设定查询条件。 ² SELECT 命令可以读取一条或者多条记录。 阅读全文
posted @ 2020-08-07 17:07 梦魇之瞳 阅读(147) 评论(0) 推荐(0) 编辑
摘要: mysql> create table student( -> sno varchar(20) not null, -> sname varchar(20) not null, -> ssex varchar(20) not null, -> sbirthday datetime, -> class 阅读全文
posted @ 2020-08-05 17:10 梦魇之瞳 阅读(90) 评论(0) 推荐(0) 编辑