将ORDER添加到SELECT请求

I am trying to order my results and I getting a TString Error. Can someone please tell me where or how I can add ORDER BY date DESC, paymentamount DESC to this:

$sql = "SELECT * FROM `Carriers` WHERE fromzip >= '".mysql_real_escape_string($_REQUEST["from"])."'".$search_string.$search_loadtype;

This is what I have tried and it doesnt let me:

  $sql = "SELECT * FROM `Carriers` WHERE fromzip >= '".mysql_real_escape_string($_REQUEST["from"])."'".$search_string.$search_loadtype ORDER BY date DESC, paymentamount DESC;

Try this..

$sql = "SELECT * FROM `Carriers` WHERE fromzip >= '".mysql_real_escape_string($_REQUEST["from"])."'".$search_string.$search_loadtype." ORDER BY date DESC, paymentamount DESC";

You need to use the (.) to piece string values together. And then you havn't opened the string with quotes...

$search_loadtype ORDER BY

Becomes

$search_loadtype." ORDER BY

I think that you missed some quote :

  $sql = "SELECT * FROM `Carriers` WHERE fromzip >= '".mysql_real_escape_string($_REQUEST["from"])."'".$search_string." ".$search_loadtype." ORDER BY date DESC, paymentamount DESC";

It seems to me you have the syntax wrong and I can't really know what $search_string and $search_loadtype contains from your code, but give the following a try...

    $sql = "SELECT * FROM `Carriers` WHERE fromzip >= '".mysql_real_escape_string($_REQUEST["from"])."'".$search_string.$search_loadtype . " ORDER BY date DESC, paymentamount DESC;";