The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Need help
hey guys, well see im trying to make it so for each question it will show all answers for that question but for some reason it is carrying over the questions from the last question and add those answers together.
see attachment for exmaple heres my code: PHP Code:
|
#2
|
||||
|
||||
anyone?
|
#3
|
||||
|
||||
First off, never put a DB query (you have two, which is even worse) into a while loop of another DB query.
Bad news, as it could call hundreds of queries thus slowing your system down. If you've tried LEFT JOIN'ing tables and that doesn't prove successful, there is usually a way to make arrays containing the data you want from each query, and then you can make one main loop and iterate through the arrays and sort the data. Hard to explain so I'll try to give an example. But first, how is this setup? Looks like you have a table for questions, a table for correct answers, and a table for user answers. How about combining the first two tables, questions and correct answers? Have the fields in one table. |
#4
|
||||
|
||||
it does make sense to left join the question and answer table
|
#5
|
||||
|
||||
Although, unless I'm interpreting it wrong, it makes more sense to combine quiz_answers and quiz_questions into one table.
|
#6
|
||||
|
||||
that might get a little confusing for me though and it would make the table very large.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|