$table
$table :
Model Class
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class Userdetail_model extends CI_Model
{
private $table ='userdetail';
public function __construct()
{
parent::__construct();
}
/**
*获取单条数据
* */
public function getUserDetailRow($userId=0)
{
$this->db->where('userId', $userId);
$result = $this->db->get($this->table);
return $result->row_array();
}
/**
* 添加
* */
public function insertData($userData)
{
$bool = $this->db->insert($this->table, $userData);
$res = $bool ? $this->db->insert_id() : false;
return $res;
}
/**
* 修改
* */
public function setUserByID($updateData, $userdetailId )
{
$this->db->where('userdetailId', $userdetailId);
return $this->db->update($this->table, $updateData);
}
/**
* 删除用户
* */
public function delete( $userId )
{
$this->db->where( 'userId', $userId );
$query = $this->db->delete( $this->table);
return $query ? $userId : false;
}
}
?>