Questo è il codice:
Codice PHP:
$order=""
if (!isset(
$_GET['sort'])) {
$order "ASC"// Default page
} else {
$order "DESC";
}

if (isset(
$_REQUEST['idCat']) && $_REQUEST['idCat']!="all") {
  
$colname_get_c $_REQUEST['idCat'];
  
$query_viewC sprintf("SELECT * FROM c WHERE cat = %s ORDER BY codice "$order .$limited"GetSQLValueString($colname_get_c"text")); 
il problema che riscontro è che, anche se nella url è presente ?sort=DESC o ASC la query non subisce alcun cambiamento. Invece, se sostituisco manualmente $order all'interno della query, con ASC o DESC, gli elementi vengono ordinati correttamente.

La curiosità è che se scrivo
Codice PHP:
if ($order=="asc") {
$orderlink = ("<a href=\"" $_SERVER["PHP_SELF"] . "?sort=desc\" title=\"Sort the records in descending order\">Sort descending</a>") ;
} else {
$orderlink = ("<a href=\"" $_SERVER["PHP_SELF"] . "?sort=asc\" title=\"Sort the records in ascending order\">Sort ascending</a>") ;
}
echo 
$orderlink 
l'echo orderlink cambia correttamente ma NON la query suscritta.

Quale può essere l'errore?