Switched from using fetch() in getCourses to store_result() because I was getting the commands out of sync error in MySQL. store_result() buffers the data so that another prepared statement can be executed without much trouble. Directions provided by StackOverflow post id 3632075 and answered by user JM4.