php code to access MySQL database with Event data