Jump to content

Sorting results from sql query by clicking a button


jond

Recommended Posts

Hi, I want to be able to sort a a list of images by clicking a button. I understand how to sort them with an sql query like this.

 

$query = mysql_query("SELECT * FROM images ORDER BY date DESC LIMIT $offset, $rowsPerPage",$con);

 

but how would I have two buttons so that the user could switch between descending and ascending? I've been trying submit buttons with if statements containing the sql query but I'm not having any luck.

 

Thanks for any help  :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.