Commit 0e36b418 authored by Gabriel Moreau's avatar Gabriel Moreau
Browse files

SQL Seclect in function get_loan_find

parent 16263dc6
......@@ -342,6 +342,16 @@ function get_loan_listall($pdo) {
// ---------------------------------------------------------------------
function get_loan_find($pdo, $find) {
$sql = 'SELECT * FROM pret WHERE commentaire RLIKE ?;';
$stmt = $pdo->prepare($sql);
$stmt->execute(array($find));
$result_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $result_fetch;
}
// ---------------------------------------------------------------------
function set_loan_new($pdo, $id_equipment, $id_team, $date_begin, $date_end, $comment) {
$sql = 'INSERT INTO pret (nom, equipe, emprunt, retour, commentaire) VALUES (?, ?, ?, ?, ?);';
$stmt = $pdo->prepare($sql);
......
......@@ -17,10 +17,7 @@ en_tete('Liste de vos emprunts');
if ($pdo = connect_db()) {
$user = get_user_all_by_id($pdo, $logged_id);
$sql = 'SELECT * FROM pret WHERE commentaire RLIKE ?;';
$stmt = $pdo->prepare($sql);
$stmt->execute(array($user['nom']));
$loan_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$loan_fetch = get_loan_find($pdo, $user['nom']);
}
?>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment