updated code to use count instead of num_rows to work with switch to mysql2 gem