CI模型的使用
来源:互联网 发布:淘宝卖家怎么处理违规 编辑:程序博客网 时间:2024/05/19 19:42
<?php
//所有的方法必须通过单入口
if(!defined('BASEPATH')) exit('No direct script access allowed');//继承CI_Model
class User_model extends CI_Model
{
public function __construct()
{
//子类的构造函数需要手工的去执行父类的构造方法
parent::__construct();
}
//获取数据表的总记录数
public function getCount(){
return $this->db->count_all_results('user');
}
//获取数据
public function getUserData($number=10,$offset=0){
$result=$this->db->get('user',$number,$offset);
return $result->result_array();
}
//添加方法
public function addUser($data){
return $this->db->insert('user',$data);
}
//删除指定数据
public function delUser($where){
return $this->db->delete('user',$where);
}
//获取一条指定的数据
public function findOne($where){
$result=$this->db->where($where)->get('user',1);
return $result->row_array();
}
//更新方法
public function edtUser($data,$where){
return $this->db->update('user',$data,$where);
}
}
?>
0 0
- CI模型的使用
- CI模型的加载
- CI 搭建简单的MVC模型示例
- CI验证码的使用
- CI中AJAX的使用
- CI 分页类的使用
- 【ci框架】ci框架查询中join的使用
- CI AR模型
- CI Weekly #19 | 关于软件开发模型的思考,以及最新 CI/CD 实践分享
- CodeIgniter学习笔记三:扩展CI的控制器、模型
- CI框架模型中常见的数据库操作
- ci框架用active_record模型实现分页的技巧
- CI面包屑的使用,附源码
- CI框架(十一)routes.php的使用
- CI模板中php脚本的使用
- 词Ci 介绍页 StackView的使用
- CI图像处理类的使用
- CI框架分页类的使用(1)
- 描述符的总结
- 自己动手写js分享插件 [支持https] (QQ空间,微信,新浪微博。。。)
- 第27篇 linux下布署vpn
- 1012. The Best Rank (25)
- if语句
- CI模型的使用
- NumPy快速入门
- Asp.net前后台代码混编
- 怎么用chrom调试javascript
- 多线程
- ios9微信支付报警告: Snapshotting a view that has not been rendered results in an empty snapshot. Ensure yo
- 图片加载框架对比分析
- MyBatis学习总结(一)配置以及增删改查
- 反射