Joshua Posted February 26, 2010 Share Posted February 26, 2010 Ok, I'm trying to make a quiz for a mod i'm designing. The problem here is. Im trying to select a random question from the database that the user hasnt already had. Got that part done. The problem I'm running into now is, when the user clicks submit for the answer, since the $db->query is selecting a random statement, the page refreshes, so does the answer and the question, into a totally differant random one >,< How can I stop this? :P Quote Link to comment Share on other sites More sharing options...
Danny696 Posted February 26, 2010 Share Posted February 26, 2010 mabey use a session or cookie?? to hold the question id in Quote Link to comment Share on other sites More sharing options...
Joshua Posted February 27, 2010 Author Share Posted February 27, 2010 I've tried and failed miserable at that >< Quote Link to comment Share on other sites More sharing options...
Zeggy Posted February 27, 2010 Share Posted February 27, 2010 If you don't want to use sessions/cookies, you can create a new column on the players table or create a new table (the better option) which will store the question ID chosen for each player. Then you can check the answer against the question saved in the database. Quote Link to comment Share on other sites More sharing options...
Joshua Posted February 27, 2010 Author Share Posted February 27, 2010 Dont get me wrong, i'd love to do the session bit, but i'm at a loss on just "how" to do it. >,< Quote Link to comment Share on other sites More sharing options...
Zero-Affect Posted February 27, 2010 Share Posted February 27, 2010 If you don't want to use sessions/cookies, you can create a new column on the players table or create a new table (the better option) which will store the question ID chosen for each player. Then you can check the answer against the question saved in the database. Zeggy does have a point Quote Link to comment Share on other sites More sharing options...
Joshua Posted February 27, 2010 Author Share Posted February 27, 2010 aye, i'm going with his session bit, it worked fine and the test is moving along, should be done in an hour once i research some hard to find questions/answers >< Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.