Or something like this?
SELECT * FROM `Bible_trivia` WHERE answer=`answer`;
Then match the results to trivia_answer_1 in php to see if correct.
if($trivia_answer_1 == $results) {
... do this
}
or a switch
switch ($results) {
case $trivia_answer_1:
... do this
Heh,
Thanks Karthik. Not my post.. :)
But your solution looks dead on..
Here you go Ron. Try this one.
Best,
Karl
On Oct 13, 2011, at 2:42 AM, Karthik S wrote:
Try this,
select
CASE answer
when 1 then trivia_answer_1
when 2 then trivia_answer_2
when 3 then
Not terribly elegant, but this should work:
SELECT `trivia_answer_1` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=1
UNION
SELECT `trivia_answer_2` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=2
UNION
SELECT `trivia_answer_3` AS `trivia_answer` FROM `Bible_trivia` WHERE
Hi
In Oracle (and maybe others) you can use
select case
when answer=1
then trivia_answer_1
when answer=2
then trivia_answer_2
when answer=3
then trivia_answer_3
when answer=4
then trivia_answer_4
else null
end answer
from bible_trivia_table
OR
You can select all of them and process in PHP,
select casehttp://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html
works in mysql also
regds
amit
The difference between fiction and reality? Fiction has to make sense.
On Thu, Oct 13, 2011 at 3:26 AM, Jack van Zanen j...@vanzanen.com wrote:
Hi
In Oracle (and maybe
another
examplehttp://mysql-tips.blogspot.com/2005/04/mysql-select-case-example.html
regds
amit
The difference between fiction and reality? Fiction has to make sense.
On Thu, Oct 13, 2011 at 9:34 AM, Amit Tandon att...@gmail.com wrote:
select