本文用到:jquery、tp框架
TP_3.2.2/Application/Home/Controller/StuController.class.PHP
PHP;">
display("school/stu");
}
public function getdata(){
$Studata = M('stu');
$data['id']='';
$data['name']=I('get.name');
$data['age']=I('get.age');
$data['num']=I('get.num');
$data['address']=I('get.add');
$Studata->add($data);
$this->success("正在。。。",U('Stu/showdata'));
}
public function showdata()
{
$Studata = M('stu');
$data=$Studata->select();
$this->assign('info',$data);
$this->display('school/showdata');
}
public function del(){
$id = I('get.id');
$Studata = M('stu');
$bool = $Studata->where(['id'=>$id])->delete();
if($bool){
echo 1;
}else{
echo 0;
}
}
public function updata()
{
$id = I('get.id');
$Studata = M('stu');
$data = $Studata->where(['id'=>$id])->find();
$this->assign('data',$data);
$this->display("school/upshowdata");
}
public function updatadeal()
{
$Studata = M('stu');
$id = I('get.id');
$data['name']=I('get.name');
$data['age']=I('get.age');
$data['num']=I('get.num');
$data['address']=I('get.add');
$bool = $Studata->where(['id'=>$id])->save($data);
if($bool){
$this->showdata();
}else{
echo 0;
}
}
}
TP_3.2.2/Application/Home/View/school/showdata.html
PHP;">
<Meta charset="UTF-8">
数据展示界面
学生信息展示
编号TP_3.2.2/Application/Home/View/school/stu.html
PHP;">
<Meta charset="UTF-8">
<Meta name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
<Meta http-equiv="X-UA-Compatible" content="ie=edge">
学号<a href="/tag/zhuce/" target="_blank" class="keywords">注册</a><a href="/tag/chaxun/" target="_blank" class="keywords">查询</a>系统
名字:
年龄:
学号:
籍贯:
TP_3.2.2/Application/Home/View/school/stu.html
PHP;">
<Meta charset="UTF-8">
<Meta name="viewport"
content="width=device-width,minimum-scale=1.0">
<Meta http-equiv="X-UA-Compatible" content="ie=edge">
学号<a href="/tag/zhuce/" target="_blank" class="keywords">注册</a><a href="/tag/chaxun/" target="_blank" class="keywords">查询</a>系统
名字:
年龄:
学号:
籍贯:
执行在浏览器里面输入:nofollow" href="http://127.0.0.1:90/TP_3.2.2/index.PHP/Home/Stu/stushow">http://127.0.0.1:90/TP_3.2.2/index.PHP/Home/Stu/stushow
点击删除
修改:
总结
以上所述是小编给大家介绍的PHP实现数据库的增删查改功能及完整代码,希望对大家有所帮助。程序员遇到问题都会上(编程之家jb51.cc)查找问题解答方法!如果觉得站点还不错,随手转发给程序员朋友一下!
猜你在找的PHP相关文章
姓名 | 年龄 | 学号 | 籍贯 | 操作 | 操作 |
---|