I had a nightmare.
或者
i dreamt a horrible dream/ nightmare.
i had a bad / sad/ unpleasant dream.
后面可以加上你做噩梦的时间