Skip to content

Commit

Permalink
Moved person::getByName() into new db
Browse files Browse the repository at this point in the history
Issue #20
  • Loading branch information
jeroenrnl committed Apr 17, 2015
1 parent 23f82af commit 1ea8b28
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions php/classes/person.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,13 @@ public static function getByName($name) {
if(empty($name)) {
return false;
}
$qry=new select(array("ppl" => "people"));
$qry->addFields(array("person_id"));
$where=new clause("CONCAT_WS(\" \", lower(first_name), lower(last_name))=lower(:name)");
$qry->addParam(new param(":name", $name, PDO::PARAM_STR));
$qry->where($where);

$sql = "SELECT person_id FROM " . DB_PREFIX . "people WHERE " .
"CONCAT_WS(\" \", lower(first_name), lower(last_name))=" .
"lower(\"" . escape_string($name) . "\")";
return self::getRecordsFromQuery($sql);
return self::getRecordsFromQuery($qry);
}

/**
Expand Down

0 comments on commit 1ea8b28

Please sign in to comment.