Created
May 8, 2012 08:47
-
-
Save rubdottocom/2633648 to your computer and use it in GitHub Desktop.
CodeIgniter: Select from database function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function get_ENTITY_by_FIELD($field) | |
{ | |
log_message('debug', __METHOD__); | |
$columns = array( | |
$this->id | |
); | |
$result = | |
$this->db | |
->select($columns) | |
->from($this->table) | |
->where($this->field, $field) | |
->get(); | |
if (!$result) $this->common->log_database_error($this->db->last_query(), $this->db->_error_message(), $this->db->_error_number()); | |
return $result->result_array(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
log_database_error: https://gist.github.com/2633658