tp5数据库的查询、增添、更新、删除数据
<?php namespace apphomecontroller; use thinkRequest; class Test { public function index() { //查询 $result=db("test")->select(); dump($result); $test=array( "name"=>"youshe", "sex"=>"男", ); db("test")->insert($test); // //删除 //$test["id"]="3"; //db("test")->where($test)->delete(); // ////更新 // $updatawhere["id"]="5"; // $updata["name"]="genxing"; // db("test")->where($updatawhere)->update($updata); //添加单条查询 $nihao["id"]="6"; $dantiao=db("test")->where($nihao)->select(); dump($dantiao); } }
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: tp5事务处理
- 下一篇: thinkphp 模板截取中文字符串函数