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 default syntax error

Thread began 8/18/2014 2:37 pm by Christopher West | Last modified 8/18/2014 2:49 pm by Jason Byrnes | 146 views | 1 replies |

Christopher WestCommunity Expert

sort order default syntax error

Hi I have applied a SORT server behavior (a well as using a search server behavior on same page)

Im trying to get the SORT to default to decending so that the latest record shows at the top of the list. but the DefaultSort parameter in the Sort server behaviour throws an error:

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 'Descending' at line 1



Here is the segment on my page that has the SORT server behavior:

php:
<?php

//WA DataAssist Sort (Copyright 2007, WebAssist.com)
//Recordset: rsCategories;
$SortThisYear = new WADA_SortObject();
$SortThisYear->DefaultSort "Descending";
$SortThisYear->ColumnList "".$_GET['Sort']  ."";
$SortThisYear->SortOrderList "Ascending";
$SortThisYear->ToggleOn true;
if ((isset(
$_GET['Sort']) && $_GET['Sort'] != "")) {
  
$SortThisYear->SetToClause $SortThisYear->getDefaultSetToClause();
  if (
$SortThisYear->ToggleOn && isset($_SESSION["WADA_OrderClause_thisyearmanager"])) {
    
$SortThisYear->ToggleClause $_SESSION["WADA_OrderClause_thisyearmanager"];
  }
}
else if (isset(
$_SESSION["WADA_OrderClause_thisyearmanager"])) {
  
$SortThisYear->SetToClause $_SESSION["WADA_OrderClause_thisyearmanager"];
}
$SortThisYear->initialize();
$_SESSION["WADA_OrderClause_thisyearmanager"] = $SortThisYear->SetToClause;
?>



Here is my recordset:

php:
<?php

mysql_select_db
($database_dinkydb$dinkydb);
$query_rsThisYear "SELECT * FROM orders WHERE Year(OrderDate) = Year(Now())";
setQueryBuilderSource($query_rsThisYear,$SearchThisYear,false);
setQueryBuilderSource($query_rsThisYear,$SortThisYear,false);
$rsThisYear mysql_query($query_rsThisYear$dinkydb) or die(mysql_error());
$row_rsThisYear mysql_fetch_assoc($rsThisYear);
$totalRows_rsThisYear mysql_num_rows($rsThisYear);
?>



Why would it throw an error if I'm simply putting in the default ORDER BY in the Sort server behavior?

Obviously if I place an ORDER BY in the actual recordset then my SORT wont work.

Chris

Sign in to reply to this post

Jason ByrnesWebAssist

For the Default Order By Clause, you need to enter the ORDER BY Clause to use by default.

"Descending" is not a valid ORDER BY Clause. nor is it even a fully formed order by clause.

a valid order by clause would be:
ORDER BY columnName DESC


where columnName is the name of the column you want to sort by default.

Sign in to reply to this post

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...