There's no way around it: you're going to have to remember which questions you've already seen. Are you using sessions? If so, you could store an array of question id's (surely you have a primary key for each question?) and...
Now that I think about it, you could make one single, random-sorted query up front, store all the primary keys in a session-variable array, and then use that array plus a simple index (also a session variable) to let you know which particular question to retrieve at each step.
The advantage of using session variables over storing something in the database is that there is automatic cleanup of them. Or, maybe that's not a benefit, depending on what you want to do when people start to take a test but don't finish it. It may be that you need to store everything in the database, but even there I would consider getting a presorted randomized question list into a table, and then draw questions from that.