ThingkPHP对数据库进行改操作
2022-11-22 加入收藏
public function test_check(){ $Experiment = M("Experiment");//实例化Experiment对象。这个对象是跟数据库的表对应的。是对experiment表进行增删改查操作 //$sno = I('sno'); $sno = '130906008'; $RowCount = $Experiment -> where("sno = $sno") -> Count();//得到满足条件的行数 //echo M("Experiment")->getLastSql(); //打印SQL语句到浏览器界面上 echo $RowCount;//打印满足条件的行数 if($RowCount > 0){ $myModel = new \Think\Model(); $result=$myModel->query("select *from g_experiment where sno = $sno;"); $this ->ajaxReturn($result); }