Fixed two bugs, 1) missing ], 2) use db = connectDB() to establish connection (I provided this function already)