Skip to content

Instantly share code, notes, and snippets.

@tristanlins
Created February 23, 2019 11:27
Show Gist options
  • Save tristanlins/0720511162bbfc6c4a9e4efa25ab8614 to your computer and use it in GitHub Desktop.
Save tristanlins/0720511162bbfc6c4a9e4efa25ab8614 to your computer and use it in GitHub Desktop.
Programmierstil / Der Anfänger & Der Profi
<?php
class UserDao {
public function findByLoginFromRequest(Request $request)
{
$sql = 'SELECT user FROM users WHERE login=:login';
$login = $request->request->get('login');
$statement = $this->database->prepare($sql);
$statement->bindValue(':login', $login);
if ($statement->execute()) {
return $statement->fetch(\PDO::FETCH_ASSOC);
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment