Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8572597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:03:22+00:00 2026-06-11T19:03:22+00:00

I am doing questionnaire on php, I am new to php. When I try

  • 0

I am doing questionnaire on php, I am new to php. When I try to show the answers, it only shows the first two questions. After the two questions, answers are not shown. I have attached the source here.

Please use the following link to view the page.
http://itsupportsrilanka.com/uaquiz/quiz.php

<body>

<form action="test.php" method="POST">


   <?php
            $result = select("SELECT * FROM questions ");
            //$row = mysql_fetch_array($result);


        ?>
<?php
$i=1;
while($row = mysql_fetch_array($result))
{
?>
<table width="581" height="299" border="1">
<tr>
<td>Union Assurance Questionnaire</td>
</tr>
<tr>
<td><?php echo $i.'.' .$row['questions']; ?>
<?php $i++; ?>
</td>
</tr>
<tr>
<td>
<?php $qId=$row['question_id'];

$result1=select("SELECT * FROM answers WHERE questionId='$qId' ORDER BY RAND()");
while($row1=mysql_fetch_array($result1)){

    ?>
    <input type="radio" name="answers" value="<?php echo $row1['answers'];?>" / ><?php echo $row1['answers']; ?><br/>


<?php 
} ?>
&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<?php
}
?>
</form>
</body> 

enter image description here
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:03:24+00:00Added an answer on June 11, 2026 at 7:03 pm

    Replace

    $result = select("SELECT * FROM questions "); with $result = mysql_query("SELECT * FROM questions ");
    

    and

    $result1=select("SELECT * FROM answers WHERE questionId='$qId' ORDER BY RAND()"); with 
    $result1=mysql_query("SELECT * FROM answers WHERE questionId='$qId' ORDER BY RAND()");
    

    and try again

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Doing my first SL4 MVVM RIA based application and i ran into the following
Doing the below will reproduce my problem: New WPF Project Add ListView Name the
Doing my first tryouts with foreign keys in a mySQL database and are trying
Doing this: var _partsCatalog = new DirectoryCatalog(directoryName);//Fully qualified path to our bin folder var
Doing a uni assignment with HTML, XML and php 5.3 (no SQL). Building a
doing the first Project Euler question: summing the multiples of 3 and 5 between
Doing an expression I get an error, can someone show me the correct syntax
After doing some reading I notice Apple pushes the use of delegates on controllers
Using SQL Server 2K8 R2, I have two related tables - Member and Questionnaire.
First time posting in Stack Overflow, hope I'm doing this right. I'm writing an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.