close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Sort Order incorrect

Thread began 1/06/2011 10:48 am by christina.elissa4324782 | Last modified 1/06/2011 1:07 pm by Jason Byrnes | 1344 views | 11 replies |

christina.elissa4324782

Sort Order incorrect

I'm attempting to sort columns using the Sorting by Column Link recipe solution. I am trying to sort 3 columns; by id, lastName, registered (date).
The id and registered appear to be sorting correctly. however the last name column is not sorting correctly; it's not alphabetical.

This is a results page and I am using pagination; showing 15 records at a time.

Can you tell me if I'm doing something incorrect?

Thank you in advance

Christina

Attached Files
attendee_Results.php.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the code looks correct.

to see the query that is being generated, add the following code after the body tag:

php:
<?php echo($query_limit_WADAattendee); ?>




can you provide a link where i can see the problem to investigate further?

Sign in to reply to this post

christina.elissa4324782

Here is what was returned on the page:

SELECT attendeeId, salutation, firstName, middleInitial, lastName, rankService, positionTitle, company, street, street2, city, stateCountry, postalCode, phoneNumber, faxNumber, email, payBy, paid, paymentReceiptEmailed, badgeNameTitle, DATE_FORMAT(registered, '%m-%d') AS registered FROM attendee ORDER BY attendeeId DESC, lastName ASC, registered DESC LIMIT 0, 10

admin/

The current login info is below



here is the search page so that you can get to the results page

Sign in to reply to this post

Jason ByrnesWebAssist

i'm getting the following error when i try to test your page:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OREDER BY lastName, firstName LIMIT 0, 10' at line 1


it looks like you added an order by clause manually ut have misspelled ORDER as OREDER

Sign in to reply to this post

christina.elissa4324782

I'm not getting that error. What page did you test?

I found where that was, and fixed it. It was in the DefaultSort in the DataAssist Sort. I put that there trying to get it to do it by default.

The problem is still there.

Sign in to reply to this post

Jason ByrnesWebAssist

In the Sorting section, you have only added the static column names. the first item should be the sort query string.

Click the button to add a new sort option. Next to column, click the lightning bolt and expand the Querystring Data binding group, select the sort querystring. Make sure this is first in the list.

Sign in to reply to this post

christina.elissa4324782

Now I'm getting a MySQL error:
Warning: sprintf() [function.sprintf]: Too few arguments in /home/ifpaor5/public_html/ifpafletcherconference.com/2011/admin/attendee_Results.php on line 162
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY attendeeId ASC, attendeeId ASC, lastName ASC, registered DESC LIMIT 0,' at line 1

Here is the Sort code:
//WA DataAssist Sort (Copyright 2007, WebAssist.com)
//Recordset: WADAattendee;
$WADA_Sort_1 = new WADA_SortObject();
$WADA_Sort_1->DefaultSort = "";
$WADA_Sort_1->ColumnList = "".((isset($_GET["sort"]))?$_GET["sort"]:"") ."^attendeeId^lastName^registered";
$WADA_Sort_1->SortOrderList = "Ascending^Ascending^Ascending^Descending";
$WADA_Sort_1->ToggleOn = true;
if ((((isset($_GET["sort"]))?$_GET["sort"]:"") != "")) {
$WADA_Sort_1->SetToClause = $WADA_Sort_1->getDefaultSetToClause();
if ($WADA_Sort_1->ToggleOn && isset($_SESSION["WADA_OrderClause_attendee_Results"])) {
$WADA_Sort_1->ToggleClause = $_SESSION["WADA_OrderClause_attendee_Results"];
}
}
else if (isset($_SESSION["WADA_OrderClause_attendee_Results"])) {
$WADA_Sort_1->SetToClause = $_SESSION["WADA_OrderClause_attendee_Results"];
}
$WADA_Sort_1->initialize();
$_SESSION["WADA_OrderClause_attendee_Results"] = $WADA_Sort_1->SetToClause;

Sign in to reply to this post

christina.elissa4324782

I tried again having to copy and past my mysql select query because editing the sort server behavior deleted most of it when I edited it. Things appear to be working now.
Thank you.
Christina

Sign in to reply to this post

Jason ByrnesWebAssist

ok, glad to hear it is working.

Sign in to reply to this post

christina.elissa4324782

Now, I'm noticing that the date is not ordered correctly. I have it based on a column that converts the date to a Unix Timestamp. It's showing Dec 2010, Nov 2010, Jan 2011 when it should be Nov 2010, Dec 2010, Jan 2011.

Wouldn't a unix timestamp be the best way to sort a date on?

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...