close ad
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


sort order default syntax error

Thread began 8/18/2014 11:37 am by Christopher West | Last modified 8/18/2014 11:49 am by Jason Byrnes | 459 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:


//WA DataAssist Sort (Copyright 2007,
//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"];
$_SESSION["WADA_OrderClause_thisyearmanager"] = $SortThisYear->SetToClause;

Here is my recordset:


$query_rsThisYear "SELECT * FROM orders WHERE Year(OrderDate) = Year(Now())";
$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.


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





Ease of use


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