fixed userId error; added select query for table