Populating table based on value in database |
If you haven't done so yet, you probably need to expand your design a bit to determine the following:
- the URI(s) you want to use for the given page(s) - the SQL required to get the data - how the user will navigate between pages, if necessary Although you can change it in the routing, the URI(s) usually determine the naming of your controller and the methods/functions in that controller. If you're selecting all rows with a particular value in one column only, then it's likely you could just pass the value as the first parameter of your method (which would also make the value the third segment of your URI, not counting your base URL), so you would just check the value to make sure it's reasonably safe to pass to the model, which would use it in the SQL to retrieve your data (possibly after performing more specific validation to reduce the chance that it will cause an error). If you need to filter on multiple columns, you may need additional parameters, but the basic idea is the same. Once the controller has retrieved the data from the model, you pass it to a view, which is, more or less, your template. The tutorial and other docs should help you get through most of it, but I'm sure people here can help with more specific questions, as well. |
Messages In This Thread |
Populating table based on value in database - by dsflyerds - 12-30-2015, 02:27 AM
RE: Populating table based on value in database - by mwhitney - 12-30-2015, 09:33 AM
RE: Populating table based on value in database - by dsflyerds - 12-31-2015, 02:51 AM
RE: Populating table based on value in database - by Wouter60 - 12-31-2015, 06:43 AM
|