Last active
December 15, 2015 22:59
-
-
Save stoddsie/5336780 to your computer and use it in GitHub Desktop.
Codeigniter:Retrieve single row from database
This file contains hidden or 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
//Setup a database connection returning a single row value | |
$this->db->select("*"); | |
$this->db->where("field", $value); | |
$query = $this->db->get("table",1,0); | |
if($query->num_rows() > 0) { | |
$variable = $query->row("field"); | |
return $variable; | |
} else { | |
return FALSE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment