Not terribly elegant, but this should work:
SELECT `trivia_answer_1` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=1
SELECT `trivia_answer_2` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=2
SELECT `trivia_answer_3` AS `trivia_answer` FROM `Bible_trivia` WHERE `answer`=3
SELECT `trivia_answer_4` AS `trivia_answer` FROM `Bible_trivia` WHERE
I have to say that it's likely that your design may not be the most optimal.
What happens if you want 5 answers? Or 6?
From: Ron Piggott [mailto:ron.pigg...@actsministries.org]
Sent: Wednesday, October 12, 2011 3:25 PM
Subject: [PHP-DB] SELECT syntax
In my Bible_Trivia table I have the columns
`trivia_answer_1`, `trivia_answer_2`, `trivia_answer_3`, `trivia_answer_4`,
`answer` is an integer always with a value of 1 to 4. Is there a way to use the
value of `answer` to only select the correct trivia answer?
This doesn’t work, but this is the idea I am trying to achieve:
SELECT `trivia_answer_`answer`` FROM `Bible_trivia`
Thanks in advance,
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php