Changed mysql queries into PDO queries (by Yossi).