473,322 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Glitch with results ordering

22
Hi, I'm working on a mysql-based survey program. On the user page I display the survey form, and on the admin page I display the results for each question. The problem, which I find puzzling, is that on the results page the order of the questions (sorted by specified question numbers) are slightly jumbled, while on the user form they work fine. I've looked at these mysql queries for a while but can't seem to pinpoint the problem. I'll paste them below and if you notice anything out of the ordinary please let me know.

*Edit: I'm posting these as plain text - didn't format well in the [code] tags...

Here's the one for the userform, which works fine:

SELECT questions.question_type_id,questions.question_id,q uestions.question_text,questions.show_comment,ques tion_choice_group.question_group_array from questions LEFT JOIN question_choice ON (questions.question_id = question_choice.question_id) AND (question_choice.survey_id = '$survey_id') LEFT JOIN question_choice_group USING (question_choice_group_id) WHERE questions.survey_id = '$survey_id' ORDER BY questions.question_order_num

Here's the one for the results page, whose order doesn't quite work:

SELECT questions.survey_id,questions.question_id,question s.question_text,answers.answer_text,questions.ques tion_type_id,question_choice.question_choice_group _id,question_choice_group.question_group_array,

count(answers.answer_text) as 'num_answers',questions.question_order_num

FROM questions LEFT JOIN answers ON (questions.question_id = answers.question_id AND questions.survey_id = answers.survey_id)

LEFT JOIN question_choice ON (questions.question_id = question_choice.question_id AND questions.survey_id=question_choice.survey_id)

LEFT JOIN question_choice_group ON question_choice.question_choice_group_id = question_choice_group.question_choice_group_id

WHERE questions.survey_id='$survey_id'

GROUP BY questions.question_text,answers.answer_text

ORDER BY questions.question_order_num
Nov 15 '06 #1
0 1212

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Ted Mayett | last post by:
OK. Here is a glitch, sorry if this has been mentioned before. This is an erratic glitch. I am now up to three other people besides myself who have been able to see this glitch. It seems it...
2
by: TomT | last post by:
If I create a Listbox with 5 users: Paul Dave Mark Sam Bob If I select 3 users:
13
by: NM | last post by:
Sometimes ago I was having a problem in linking between C++ and Fortran program. That was solved (using input from this newsgroup) using the Fortran keyword "sequence" with the derived types (to...
12
by: Larry Bates | last post by:
I'm trying to get the results of binascii.crc32 to match the results of another utility that produces 32 bit unsigned CRCs. binascii.crc32 returns results in the range of -2**31-1 and 2**21-1....
8
by: Max | last post by:
Hi everybody, suppose you have to order a list of integers which refer to points located in the 3D space. The compare() function is based on the distance that these points have with respect to...
5
by: deane.barker | last post by:
Consider this SQL: SELECT my_field FROM my_table WHERE my_field IN ('value2', 'value1', 'value3') Simple enough, but is there anyway to specify that the result should be ordered exactly like...
1
by: digidave | last post by:
I am keenly aware that my coding skills are extremely noob but please indulge me a second.. Take a look at these queries.. $sql = "SELECT DISTINCT year FROM _current_floats_config WHERE active =...
1
by: sxwend | last post by:
I am trying to use the following post results (http://www.thescripts.com/forum/thread189759.html) and add another requirement. I need to send the results to just the email addresses that the query...
3
by: Whizzo | last post by:
Hi all; I'm a bit curious about a little glitch I'm having... I'm not ready to disable the mouse wheel yet because I'm hoping for a simple fix! On a tabualr form, if you roll the mouse wheel down,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.