Code: Select all
SELECT * FROM `table` WHERE id = 1Code: Select all
public function load($conditions, $fields_array=null){
$select_fields = "*";
if($fields_array) $select_fields = implode(",", $fields_array);
$sql = "SELECT " . $select_fields . " FROM `" . $this->table . "` WHERE " . $conditions . " LIMIT 1";
//echo $sql;
$result = $this->query($sql);
if($result->length()){
foreach($this->fields as $key => $value){
$value->setValue($result->{$key});
echo gettype($result->{$key}); // Always outputs "string"
}
return true;
}
return false;
}