Event insert and select query working