Change $database to $db (less readable/clean code, but more fork).
Added space after type cast.