arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Help]Php and Mysql
#3
No, the question and answers are not repeated..Each question has an id,question and answer..I was just making a thing by which I don't have to send user an OTP or activation email,my aim is to ask a random question to a newly registered user then,If he answer the question correctly (i.e his answer matches with the answer of asked question from database),then I will update a column and mark the user as active.Hope it clears what I want to achieve,but If not,then I post a code here so that It will make you clear about my question.

Assume,something like this:
qid question answer
1 2 + 2 4
2 4 / 2 2
3 2 x 2 4

My select query:
PHP Code: (Select All)
$random_id rand(1,3);
$qry SELECT from quest_table WHERE qid $random_id;
$result mysql_query($qry,$con);//$con is a php file containing connection details
while ($row mysql_fetch_assoc($result))  
{  
echo 
$row['question];//A random question is visible in form


Suppose, question is 2 + 2,so user must answer 4(so it gets matched with the answer of the table). Waiting for reply.
lockThread Closed 


Messages In This Thread
[Help]Php and Mysql - by jayant - 12-24-2016, 07:33 PM
RE: [Help]Php and Mysql - by Dynamo - 12-25-2016, 01:12 AM
RE: [Help]Php and Mysql - by jayant - 12-26-2016, 06:01 AM
RE: [Help]Php and Mysql - by Dynamo - 12-26-2016, 10:33 AM
RE: [Help]Php and Mysql - by jayant - 12-26-2016, 01:40 PM
RE: [Help]Php and Mysql - by Dynamo - 12-26-2016, 01:46 PM

Possibly Related Threads…
Thread
Author
Replies
Views
Last Post

person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting