1 | <?php |
2 | |
3 | require_once __DIR__ . "/../modelo/Pasatiempo.php"; |
4 | require_once __DIR__ . "/Bd.php"; |
5 | |
6 | function pasatiempoBusca(int $id): false|Pasatiempo |
7 | { |
8 | $con = Bd::getConexion(); |
9 | $stmt = $con->prepare( |
10 | "SELECT |
11 | PAS_ID AS id, |
12 | PAS_NOMBRE AS nombre |
13 | FROM PASATIEMPO |
14 | WHERE PAS_ID = :id" |
15 | ); |
16 | $stmt->execute([":id" => $id]); |
17 | $stmt->setFetchMode( |
18 | PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, |
19 | Pasatiempo::class |
20 | ); |
21 | return $stmt->fetch(); |
22 | } |
23 |