Set PDO::ATTR_ERRMODE to PDO::ERRMODE_EXCEPTION. Set PDO::ATTR_EMULATE_PREPARES to false so the database (not PHP) does the prepare. Set PDO::ATTR_DEFAULT_FETCH_MODE to PDO::FETCH_ASSOC.
Always pass user input as parameters, not as concatenated strings. Bound parameters give you both safety and a planned query the database can cache.
For large result sets, use fetchAll() only if memory permits — otherwise iterate with fetch() in a loop or use unbuffered queries.