Copy link to clipboard
Copied
Newbie here. I have an MYSQL database where each item has a "category" column. I am trying to have a page that lists all of the possible categories, and when you click on one of the links, it takes your to a page with a recordset that is filtered for that category. I know how to filter my recordset by category but my question is how do I make a link that will instruct the server to filter the recordset based on the selected category? Thanks for any help somebody can offer.
Copy link to clipboard
Copied
Moved to the Dreamweaver Application Development forum, which deals with PHP/MySQL and other server-side issues.
The way to handle this issue is to use a query string at the end of the URL. A query string consists of a question mark followed by one or more name/value pairs. If there is more than one name/value pair, separate each pair with an ampersand. So, to select your category you would create something like this:
<a href="details.php?category=software">See software details</a>
You filter the recordset in details.php using a URL parameter to set the value of the category column to software.
If you are creating a page to build these links automatically, you need to create a recordset of all the categories, and loop through a repeat region using the recordset value:
<a href="details.php?category=<?php echo $row_recordsetName['category']; ?>">
See <?php echo $row_recordsetName['category']; ?> details</a>
Copy link to clipboard
Copied
Assuming in that item table, the category value is
1. Integer
<a href="details.php?id=<?php echo $row_getItems['category']; ?>">Click Here</a>
Then in your browser the URL will be
www.yoursitename.com/details.php?id=1
2. String
<a href="details.php?id=<?php echo $row_getItems['category']; ?>">Click Here</a>
Then in your browser the URL will be
www.yoursitename.com/details.php?id=technology