Forum Moderators: coopster
I am wondering if you people can help.
This code doesn't appear to work :
$q = 'SELECT ident, type, question, option1, option2, option3, option4, answer, stage
FROM data
WHERE type="test" AND ident!="'.$usedids.'"
ORDER BY RAND()
LIMIT 1';
Now $usedids is simply "125,54,56,36" etc. Basically I am trying to put together a quiz. Now I am trying to get it to select a random question from the database. The hard part comes is not showing that question again. Once a question is displayed I am storing it in an array. Each time a question is displayed it is being added to the array. What I am trying to get it to do, is every time it selects a question it should pick one in $usedids(which is now a comma sepreated string".
It seems to work for the first id, in this example 125. So once it has been displayed once the question with id 125 is not shown again - good. However it doesn't do this for the rest of the values in the string? Any idea why?
* In a nutshell I guess what I am trying to say is why can't I say the following. The first line works fine, but the second line doesn't?
Works :
WHERE type="test" AND ident!="123"Doesn't work :
WHERE type="test" AND ident!="123,124,54,894"
? Please help!