Commit 06d56e79 authored by Gabriel Moreau's avatar Gabriel Moreau
Browse files

Add function get_user_all_by_id

parent 6e57d98a
......@@ -120,7 +120,7 @@ function get_equipment_listshort($pdo) {
$sql = 'SELECT id, nom FROM Listing;';
$stmt = $pdo->prepare($sql);
$stmt->execute();
$result_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$result_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $result_fetch;
}
......@@ -140,7 +140,7 @@ function get_supplier_by_id($pdo, $id) {
$sql = 'SELECT id, nom FROM fournisseurs WHERE id = ?;';
$stmt = $pdo->prepare($sql);
$stmt->execute(array($id));
$supplier_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$supplier_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $supplier_fetch[0];
}
......@@ -150,7 +150,7 @@ function get_supplier_listshort($pdo) {
$sql = 'SELECT id, nom FROM fournisseurs;';
$stmt = $pdo->prepare($sql);
$stmt->execute();
$supplier_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$supplier_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $supplier_fetch;
}
......@@ -160,7 +160,7 @@ function get_supplier_listall($pdo) {
$sql = 'SELECT * FROM fournisseurs;';
$stmt = $pdo->prepare($sql);
$stmt->execute();
$supplier_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$supplier_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $supplier_fetch;
}
......@@ -172,7 +172,7 @@ function get_supplier_find($pdo, $find='') {
$sql = 'SELECT * FROM fournisseurs WHERE nom RLIKE ? OR descr RLIKE ?;';
$stmt = $pdo->prepare($sql);
$stmt->execute(array($find, $find));
$supplier_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$supplier_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $supplier_fetch;
}
......@@ -182,7 +182,7 @@ function get_team_by_id($pdo, $id) {
$sql = 'SELECT id, nom FROM equipe WHERE id = ?;';
$stmt = $pdo->prepare($sql);
$stmt->execute(array($id));
$team_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$team_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $team_fetch[0];
}
......@@ -192,7 +192,7 @@ function get_team_listshort($pdo) {
$sql = 'SELECT id, nom FROM equipe;';
$stmt = $pdo->prepare($sql);
$stmt->execute();
$team_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$team_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $team_fetch;
}
......@@ -202,7 +202,7 @@ function get_team_listall($pdo) {
$sql = 'SELECT * FROM equipe;';
$stmt = $pdo->prepare($sql);
$stmt->execute();
$team_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$team_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $team_fetch;
}
......@@ -212,7 +212,7 @@ function get_team_with_appareil($pdo) {
$sql = 'SELECT id, nom FROM equipe INNER JOIN Listing ON equipe.id = Listing.equipe;';
$stmt = $pdo->prepare($sql);
$stmt->execute();
$team_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$team_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $team_fetch;
}
......@@ -222,8 +222,22 @@ function get_user_by_id($pdo, $id) {
$sql = 'SELECT id, nom FROM users WHERE id = ?;';
$stmt = $pdo->prepare($sql);
$stmt->execute(array($id));
$user_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $user_fetch[0];
$result_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($result_fetch) > 0)
return $result_fetch[0];
return false;
}
// -------------------------------------------------------------
function get_user_all_by_id($pdo, $id) {
$sql = 'SELECT * FROM users WHERE id = ?;';
$stmt = $pdo->prepare($sql);
$stmt->execute(array($id));
$result_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($result_fetch) > 0)
return $result_fetch[0];
return false;
}
// -------------------------------------------------------------
......@@ -232,7 +246,7 @@ function get_version_by_name($pdo, $name) {
$sql = 'SELECT version FROM version WHERE name = ?;';
$stmt = $pdo->prepare($sql);
$stmt->execute(array($name));
$version_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
$version_fetch = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($version_fetch) > 0)
return $version_fetch[0];
return false;
......
Supports Markdown
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