Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Recordset sort

Guest
Jun 24, 2007 Jun 24, 2007
I have a recordset (responders) that I would like to sort in the following manner:

SELECT *
FROM responders
ORDER BY responders.COUNTRY, responders.`STATE`, responders.CITY

After is construct the recordset, I test it and get good results (clean).
When I run a test us the the sorted recordset in a program I get the following result:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in
/home/content/m/i/l/miltonembs/html/quik_classes/responder_master_unanswered.php on
line 112

I would appreciate any help that I can get.
Milt
TOPICS
Server side applications
345
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 25, 2007 Jun 25, 2007
i am not into mysql - but "responders.'state' is looking strange - maybe the ' ' will be rewrite during the process ... so the SQL statement the website is "posting" to the DB ist not the same anymore.

try to output (response.write) the sql statement on the website (for testing) just before the code execute this . so you will see, if its still the same

' ' are unsafe for SQL injection reasons

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 25, 2007 Jun 25, 2007
Thank you for your response.
I did notice the same thing and I reviewed the code generated in the Dreamweaver program and found the references to 'STATE'. I removed the '' from the code generated in the program and reran the program and found that I received the same error. In addition, I rewrote the entire line of code in the Recordset dialog box and it also tested fine ( the table was reproduced in the proper order) but the error message again reappeared when I OK'ed the recordset dialog box and tested the updated program.
The problem has to be somewhere in the Dreamweaver code that converts the recordset dialog input and places it into the program. I am not a strong MySQL programmer either but I suspect that is not where the problem is located. I have updated to 8.0.2 and I have reviewed all of the known problems but I haven't run across anything like this. It would seem that there would be an uproar over this problem because I can't conceive of any one writing a program that doesn't sort records by more than one field.
Thanks again for your kind effort.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 25, 2007 Jun 25, 2007
1. in answer to your summary statement: "How can I exclude records that have a certain code in a text box"

build your SELECT statement with the WHERE clause and have it equal to your "certain code". test it. if it works then flip
around the WHERE clause yo be NOT or <>.

2. debug your SELECT statement below by stripping out the ORDER BY clause, test and then add back in each of the three ORDER BY to see when it produces the error code.

SELECT *
FROM responders

SELECT *
FROM responders
ORDER BY responders.COUNTRY

SELECT *
FROM responders
ORDER BY responders.COUNTRY, responders.`STATE`

SELECT *
FROM responders
ORDER BY responders.COUNTRY, responders.`STATE`, responders.CITY

i gave you a strategy rather than an answer. hope it works.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 27, 2007 Jun 27, 2007
LATEST
Thank you JohnDough for the advice...your solution worked fine...appreciated
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines