Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort Repeat Region 1

Status
Not open for further replies.

shop73

IS-IT--Management
May 13, 2007
48
BA
How to sort repeat region ASC and DESC?
 
How to sort repeat region ASC and DESC same time for 3 columns?

name - categories - quantity
 
I make this links for sort-ing:

pricelist.php?sortby=prodName

pricelist.php?sortby=categories

pricelist.php?sortby=prodPrice

and recordset "ProductPrice" with "sortby" variables (sortby, prodName, $_GET['sortby'] values and SQL query:

SELECT products.prodName, products.prodPrice, categories.categoryName AS categories, products.prodID
FROM products, categories
WHERE products.categoryID = categories.categoryID
ORDER BY sortby

This works but I can't sorting same time by prodName ASC and DESC.

When I click prodName first time I get sort ASC but If I click prodName again nothing happens (I can't sorting DESC).
 
This works but I can't sorting same time by prodName ASC and DESC.
You can only sort one way or the other at any one time

When I click prodName first time I get sort ASC but If I click prodName again nothing happens (I can't sorting DESC).
Add a radio button to your form to select direction

Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
ok so you want a link to toggle the direction of the sort

In that case you pass a querystring to indicate which way

for example pagename.php?dir=a for will give ascending

and then use PHP to write the link out to reverse the direction

Code:
echo 'pagename.php?';
if ($_get('dir') == "d") {
     echo 'dir=a';
} else {
     echo 'dir=d';
}


Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
I can't do this!

How to start building that?

Which pages, queries must to build?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top