Search the Community
Showing results for tags 'sorting'.
-
First I just want to thank Larry for explaining PHP in a method I could understand. From reading his book in three days I went from a barely functioning site with security holes to a improved, stable site. If your interested in seeing it, its here, http://medieval.name I did have one issue, that is with using a sort feature. I use the template from Chapter 10. Setting the sort variable, setting up the switch, adding $order_by to the query, adding sort to the pagination. The sort works, but it sorts all data, not limiting itself to the data from the query. Im sure Im missing something obvious. The following is the only editing I did, // Default is by registration date. $sort = (isset($_GET['sort'])) ? $_GET['sort'] : 'te'; // Determine the sorting order: switch ($sort) { case 'te': $order_by = 'term ASC'; break; case 'ct': $order_by = 'category ASC'; break; case 'pl': $order_by = 'place ASC'; break; default: $order_by = 'term ASC'; $sort = 'te'; break; } echo ' <a href="search_results.php?sort=te">Term</a> <a href="search_results.php?sort=ct">Category</a> <a href="search_results.php?sort=pl">place</a> '; Suggestions are welcome.
- 7 replies
-
- chapter 10
- sort
-
(and 2 more)
Tagged with: