function get_user($user_id) { $pdo = new PDO("mysql:host=localhost;dbname=mydb", "username", "password"); $stmt = $pdo->prepare("SELECT * FROM users WHERE id = :id"); $stmt->execute(['id' => $user_id]); $row = $stmt->fetch(PDO::FETCH_ASSOC); return $row; } $user = get_user(1); // Example output /* Array ( [id] => 1 [name] => John Doe [email] => john.doe@example.com [password] => $2y$10$W1CEd9XmSRnKHxSnQ2a0huI4XFJjc4t62P4ZeTIimFtW5p5XfS5US ) */In this example, the `get_user()` function is used to retrieve a user record from the "users" table based on the provided ID. The function connects to the database using PDO, prepares a SELECT statement with a parameterized query to prevent SQL injection, executes the statement with the provided parameter, and fetches the row using the `PDO::FETCH_ASSOC` flag to return the result as an associative array. The package/library used in this example is PDO, which is a PHP extension for interacting with databases using a standardized API.