473,786 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Glitch with results ordering

22 New Member
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.quest ion_type_id,que stions.question _id,questions.q uestion_text,qu estions.show_co mment,question_ choice_group.qu estion_group_ar ray from questions LEFT JOIN question_choice ON (questions.ques tion_id = question_choice .question_id) AND (question_choic e.survey_id = '$survey_id') LEFT JOIN question_choice _group USING (question_choic e_group_id) WHERE questions.surve y_id = '$survey_id' ORDER BY questions.quest ion_order_num

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

SELECT questions.surve y_id,questions. question_id,que stions.question _text,answers.a nswer_text,ques tions.question_ type_id,questio n_choice.questi on_choice_group _id,question_ch oice_group.ques tion_group_arra y,

count(answers.a nswer_text) as 'num_answers',q uestions.questi on_order_num

FROM questions LEFT JOIN answers ON (questions.ques tion_id = answers.questio n_id AND questions.surve y_id = answers.survey_ id)

LEFT JOIN question_choice ON (questions.ques tion_id = question_choice .question_id AND questions.surve y_id=question_c hoice.survey_id )

LEFT JOIN question_choice _group ON question_choice .question_choic e_group_id = question_choice _group.question _choice_group_i d

WHERE questions.surve y_id='$survey_i d'

GROUP BY questions.quest ion_text,answer s.answer_text

ORDER BY questions.quest ion_order_num
Nov 15 '06 #1
0 1236

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

Similar topics

11
3012
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 only happens in IE. And the <hr> causes this thing to happen. Now, I have ~tried~ to make this glitch, and that is tough to do. I had did it that one time, and I should have saved the work. But I didn't save the work :(
2
1402
by: TomT | last post by:
If I create a Listbox with 5 users: Paul Dave Mark Sam Bob If I select 3 users:
13
2544
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 assume contiguous space). Now I am having problem again. In order to show the problem I have created small program and this time there is no data straucture being passed between C++ and Fortran. Here is how the program looks like
12
9881
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. Has anyone ever worked out any "bit twiddling" code to get a proper unsigned 32 bit result from binascii.crc32? Output snip from test on three files: binascii.crc32=-1412119273, oldcrc32= 2221277246
8
2349
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 the origin (0,0,0). So, using the standart qsort() function, I think this task should be accomplished as follows: qsort(int_vector, (size_t)no_of_points, sizeof(int), compare_function);
5
11137
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 the "IN" clause states? So when this recordset comes back, I want it like this: my_field
1
2002
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 = 'yes' ORDER BY year DESC LIMIT 2, 1"; $result = mysql_query($sql); while($fetched = mysql_fetch_array($result)) { $ceiling = $fetched; } $sql = "SELECT * FROM _current_floats WHERE active = 'yes' AND yearID <= $ceiling ORDER BY yearID...
1
6574
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 specifies for each record... Essentially this is a make shift Ordering Tool and I want to be able to notify the receiver of the order and its specifics. q_Order_Detail_4email consists of ,,, and Example: Hello@mail.com,956,Modem,1000,xyz123...
3
1515
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, the top record disappears. This happens even if the number of records visible donesn't even fill the total space the form is allocated. This normally wouldn't be a problem, but rolling the mousewheel up again doesn't bring the record back! You...
0
9655
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.