synPred Posted June 12, 2015 Share Posted June 12, 2015 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 https://forums.phpfreaks.com/topic/296774-displaying-content-based-on-user/ Share on other sites More sharing options...
Barand Posted June 12, 2015 Share Posted June 12, 2015 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 Link to comment https://forums.phpfreaks.com/topic/296774-displaying-content-based-on-user/#findComment-1513731 Share on other sites More sharing options...
synPred Posted June 12, 2015 Author Share Posted June 12, 2015 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 https://forums.phpfreaks.com/topic/296774-displaying-content-based-on-user/#findComment-1513735 Share on other sites More sharing options...
Barand Posted June 12, 2015 Share Posted June 12, 2015 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 https://forums.phpfreaks.com/topic/296774-displaying-content-based-on-user/#findComment-1513737 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.