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