Skip to content

Instantly share code, notes, and snippets.

@klebinhopk
Created November 18, 2018 12:52
Show Gist options
  • Save klebinhopk/204975332e85e27afa2507be107479b6 to your computer and use it in GitHub Desktop.
Save klebinhopk/204975332e85e27afa2507be107479b6 to your computer and use it in GitHub Desktop.
Codeigniter, Model, PHP: Check if user already exists in database
public function user_exists($user_id)
{
$this->db->where('user_id', $user_id);
$query = $this->db->get('sometablenamehere');
if($query->num_rows >= 1)
{
//if query finds one row relating to this user then execute code accordingly here
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment