Re: SELECT syntax

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 trivia_answer_3
         when 4 then trivia_answer_4
END as trivia_answers
from bible_trivia_table

On Thu, Oct 13, 2011 at 1:02 PM, Karl DeSaulniers <karl@xxxxxxxxxxxxxxx > wrote:
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
       case $trivia_answer_2
               ... do this

Best,
Karl


On Oct 12, 2011, at 11:04 PM, Amit Tandon wrote:

SELECT `trivia_answer_`answer`` FROM `Bible_trivia`

Karl DeSaulniers
Design Drumm
http://designdrumm.com



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Karl DeSaulniers
Design Drumm
http://designdrumm.com


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux