Jump to content

Displaying content based on user?


synPred

Recommended Posts

Hi Guys,

 

I'm new here and need help of the the brains here..... I am developing a website that has questions on it and different groups of questions (http://puu.sh/ilYss/2c93f9a0d5.png) However I am stuck.... What I'm trying to do is :

 

Display Questions for each category based on the team, two teams would have the same questions and two other team would have different questions. But I need them displayed like the image above, in their own category... I am not sure how to link them? 

 

challenges.php 

        <div class="row">
      			<?php
while($data = mysqli_fetch_row($result)){
    if($data[0] != null){
  echo('
  <div class="col-md-3 col-sm-6">
                <div class="panel panel-default text-center">
                    <div class="panel-heading">
                        <span class="fa-stack fa-5x">
                              <i class="fa fa-circle fa-stack-2x text-primary"></i>
                              <i class="fa fa-question fa-stack-1x fa-inverse"></i>
                        </span>
                    </div>
                    <div class="panel-body">
                        <h4>'.$data[1].'</h4>
                        <p>'.$data[2].'</p>
                        <a href="question.php?id='.$data[0].'" class="btn btn-primary">View Question </a>
                    </div>
                </div>
            </div>
  ');}else{
        echo "Hello";
    }
        }
 
        ?>
            
    
        </div>

 Questions.php

  $challengeID = $_GET['id'];

$order = "SELECT * FROM questions  WHERE questionID='$challengeID'";
$result = mysqli_query($mysqli,$order);

<div class="row">
    <div class="col-lg-12"><h3>Question -  <small>
        <?php 
    while ($row=mysqli_fetch_array($result2)) {
        $questionValue=$row["value"];
        echo "Worth: " . $questionValue . " Points";
    }
?>        
        </small> </h3>
        <?php while ($row=mysqli_fetch_array($result)) {
            $questionID=$row[ "questionID"];
            $question=$row[ "question"];
            echo "<p>$question</p>"; 
            }
        ?>


    </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <h3>Answer</h3>
            <form action="answers-check.php" method="post">
                <div class="form-group">
                    <input type="text" name="id" hidden="hidden" value="<?php echo $_GET['id']; ?>" />
                    <label for="comment">Enter Challange Answer Below</label>
                    <textarea class="form-control" name="answer" rows="5" id="comment"></textarea>
                </div>
        </div>
    </div>

I have also attached a copy of the database structure

 

Hopefully someone can help!

 

Regards

K

Print%20view.pdf

Link to comment
Share on other sites

How many questions are asked per category?

 

Are the questions multiple choice? If so, how do you identify the correct one?

 

How do you record which answers were given by a team?

 

How do you decide if the answer is correct, or partially correct, and therefore how many points?

 

What is the purpose of "Question Group"?

 

How does a "Challenge" relate to your data? (your code selects one question for a challengeID). I would have expected a "challenge" to relate two teams (A and B) who would share the common set of questions

post-3105-0-85318400-1434115775_thumb.png

Edited by Barand
Link to comment
Share on other sites

How many questions are asked per category?

 

Are the questions multiple choice? If so, how do you identify the correct one?

 

How do you record which answers were given by a team?

 

How do you decide if the answer is correct, or partially correct, and therefore how many points?

 

What is the purpose of "Question Group"?

 

How does a "Challenge" relate to your data? (your code selects one question for a challengeID). I would have expected a "challenge" to relate two teams (A and B) who would share the common set of questions

 

Hi Barand,

 

Thank you for your response, So you are correct in assuming that two teams (a and b) share the same common set of questions, I Need help with the code for linking to the correct questions per category for the team, so team team A and B have the same question in category 1 and team C and D have different questions in Category 1.

Link to comment
Share on other sites

Thank you for clarifying those questions that I had about your data. ::)

 

It would have given me a greater insight into what you want to do and enabled me to give you a better answer on how best to allocate and link the questions to the teams.

 

However, as it is, I now know no more than when you originally posted, So I will wish luck with this project and say goodbye.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.