开发者

Using orderby in php put make it descending....how?

I'm trying to make it so that users can sort a certain column ascending or descending by clicking on little arrow .gif links.

Here's some code:

echo("<tr><td><a href=\"?orderby=quarterback_first desc\"><!-- IMAGE HERE --></a>First Name</td>");
开发者_高级运维

My issue is that ?=orderby=quarterback_first works just fine, but as soon as I put the desc in there it doesn't know that I want it to sort it descending. Is there a command or something I'm missing to make it so that it will sort it the way I want? Thanks for your time! First post, be nice. :)

Thanks for responses. Here's more code:

$orders=array("quarterback_draft_pick", "quarterback_pass_rating", "quarterback_first","quarterback_last", "quarterback_draft_year","quarterback_draft_round","quarterback_pass_comps","quarterback_pass_yards","quarterback_pass_td","quarterback_pass_int");
$key=array_search($_GET['orderby'],$orders);
$orderby=$orders[$key];


Perhaps a more sensible solution would be:

?orderby=quarterback_first&direction=desc

Just add a second parameter.


watch the space between 'quarterback_first' and 'desc'

try:

echo("<tr><td><a href=\"?orderby=quarterback_first&sort=desc\"><!-- IMAGE HERE --></a>First Name</td>");

and grap the desc-value via $_GET['sort']

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜