I have the following sql that pulls info for a specific user:
public function getForUniqueID($unique_id) {
$sql = "SELECT `first_name` as first_name, `last_name` as last_name FROM `{$this->table}` WHERE `unique_id` = ? LIMIT 1";
$stmt = $this->pdo->prepare($sql);
$stmt->execute([$unique_id]);
if ($stmt->rowCount() == 0) return null;
$tournament = $stmt->fetchAll(PDO::FETCH_NAMED);
$tournament = $tournament[0];
$tournament = $this->applyRelations($tournament);
return $tournament;
}
This returns an array object but I'd like to return the first_name and last_name values as one string in this format: first_name " " last_name
How can I modify the method above to return the first and last name as a single string?