Checking a table for matching ids

basically if "question" has been viewed by "email"

Page 1 of 1

5 Replies - 1351 Views - Last Post: 18 October 2006 - 08:56 AM Rate Topic: -----

#1 °•Guru•°  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 17-October 06

Checking a table for matching ids

Post icon  Posted 17 October 2006 - 06:56 PM

basically if "question" has been viewed by "email" don't show that question again

and then randomize the rest of the questions and show them that but don't repeat question its for a quiz

cheers in advance peeps :) i know u can randomize the query using RAND() which works but i get repeats how do i stop that. and check which email has viewed which question

Is This A Good Question/Topic? 0
  • +

Replies To: Checking a table for matching ids

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,506
  • Joined: 12-July 02

Re: Checking a table for matching ids

Posted 17 October 2006 - 07:00 PM

How are you tracking which email has viewed a question?
Was This Post Helpful? 0
  • +
  • -

#3 °•Guru•°  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 17-October 06

Re: Checking a table for matching ids

Posted 17 October 2006 - 07:02 PM

View PostAmadeus, on 17 Oct, 2006 - 07:00 PM, said:

How are you tracking which email has viewed a question?

they would fill a form when they start the quiz with their email and name in flash and then that would add the name and email to the database which works...but its how to track that which is where i am having the problem with...which avenue should i take?? i'm confused with it
Was This Post Helpful? 0
  • +
  • -

#4 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: Checking a table for matching ids

Posted 17 October 2006 - 07:03 PM

What you'll need to do is store what has already been seen. But assuming the user is bored and just keeps refreshing the apge, you will probably need to reset this data once the user has viewed all there is or not store such information in the first place.

If you don't have many records in your database right now, that's probably the reason for the repeated results. Now if you had say like 100, the likelyhood of having repeated returns close together will be smaller.
Was This Post Helpful? 0
  • +
  • -

#5 °•Guru•°  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 17-October 06

Re: Checking a table for matching ids

Posted 17 October 2006 - 07:11 PM

View Posthotsnoj, on 17 Oct, 2006 - 07:03 PM, said:

What you'll need to do is store what has already been seen. But assuming the user is bored and just keeps refreshing the apge, you will probably need to reset this data once the user has viewed all there is or not store such information in the first place.

If you don't have many records in your database right now, that's probably the reason for the repeated results. Now if you had say like 100, the likelyhood of having repeated returns close together will be smaller.


hmm ok it sounds right but my mysql skill and php are a lil rusty is there any tuts on cookies u can think of or queries that may help me...i can plan it in my head perfectly but its creating it...

cheers
Was This Post Helpful? 0
  • +
  • -

#6 Trogdor  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 627
  • Joined: 06-October 06

Re: Checking a table for matching ids

Posted 18 October 2006 - 08:56 AM

The rand function does not work in sqlserver, it will produce the same result for every row in the query and thus not randomly order them.
If you are using sqlserver use:
SELECT TOP 1 ID, otherfields FROM Yourtable ORDER BY NEWID()


This post has been edited by Trogdor: 18 October 2006 - 08:56 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1