Hi i have a sorting question to ask.
My database has images with “Photoname” as one of the columns in mySQL table.
Database:
Photoname
Apple
Bear
Cat
Orange
So in my catalog.php, I would display all the images from the database. Then, i have a navigation bar(div) to allow viewers to filter the images. So users can view by A | B | C… | Z|.
My question is with regards to the URL and approarch. I would create imagesort.php which would handle all the mySQL in a general way( so that i don’t have to waste time creating for A – Z).
Should the imagesort.php be something like imagesort.php?sort=A? Then in imagesort.php how can i get the value A? For example:
select photoname, date from image where photoname LIKE 'a%'
And also if the above way is correct, how can i parse this variable A to the link in catalog.php?
Here is what i’ve done so far in my catalog.php:
<ul>
<li><a href="imagesort.php?sort=A">A</a></li>
<li><a href="imagesort.php?sort=B">B</a></li>
<li><a href="imagesort.php?sort=C">C</a></li>
...
</ul>
Do i really have to do this for 26 entries? or is there a simpler method?
You can use something like this…