Skip to content

Instantly share code, notes, and snippets.

@tony1223
Created October 13, 2012 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tony1223/3885055 to your computer and use it in GitHub Desktop.
Save tony1223/3885055 to your computer and use it in GitHub Desktop.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class UserModel extends CI_Model {
function __construct()
{
parent::__construct();
}
function insert($account,$password){
$this->db->insert("user",
Array(
"account" => $account,
"password" => $password
));
}
function checkUserExist($account){
$this->db->select("COUNT(*) AS users");
$this->db->from("user");
$this->db->where("account", $account);
$query = $this->db->get();
return $query->row()->users > 0 ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment