Skip to content

Instantly share code, notes, and snippets.

@melihbuyuk
Created January 1, 2011 14:33
Show Gist options
  • Select an option

  • Save melihbuyuk/761777 to your computer and use it in GitHub Desktop.

Select an option

Save melihbuyuk/761777 to your computer and use it in GitHub Desktop.
user model
<?php
if (! defined('BASEPATH')) exit('No direct script access');
class userModel extends Model {
var $dbTableName = 'identities'
function userModel() {
parent::Model();
}
public function getUserCheck($id) {
$check = $this->db->get_where($this->dbTableName, array( 'id' => $id ), 1, 0);
if ( $check->num_rows() === 1 ) {
return $check->row();
}
return NULL;
}
public function getUserBy($id) {
$query = $this->db->get_where($this->dbTableName, array( 'id' => $id ), 1, 0);
return $query->row();
}
public function getUserNameCheck($array) {
$query = $this->db->get_where($this->dbTableName, $array, 1, 0);
if ( $query->num_rows() === 1 ) {
return $query->row();
}
return NULL;
}
public function newUserCreate($insert) {
return $this->db->insert( $this->dbTableName, $insert);
}
public function getUserDelete($id) {
return $this->db->delete( $this->dbTableName, array( 'id' => $id ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment