Welcome Guest, Not a member yet? Register   Sign In
User Selected View Table Fields... How To??
#1

[eluser]dhall[/eluser]
I have a single database table with roughly 20 fields.
I want to give the user the ability to select which fields they view in a table on my site.

Here are my thoughts on how to do this.
Give the user a list of all fields with a checkbox for each.
This is then saved to a different database table.
When the user calls this particular page it first pulls their selected fields, puts the results into a mysql query somehow, then builds the table with the results.

Does this sound correct?
Anyone have a good example of this or some helpful advice?

Thanks!
#2

[eluser]Aken[/eluser]
Sounds about right to me. No examples of how to do it, but follow your plan and it should be good.

You might want to obscure the actual column names a bit, just to help prevent people from guessing your DB schema and causing trouble. You'll also want to make sure the actual names that you code into your PHP are never displayed by accident, either from an error or other means.
#3

[eluser]dhall[/eluser]
Thanks.
Now how would I go about taking their selected results and putting those into a query to get the matching fields?
MySQL example would help.

Thanks again!
#4

[eluser]CroNiX[/eluser]
Assemble the checkbox post values into a comma separated string of field names and have it be the select portion of the query...




Theme © iAndrew 2016 - Forum software by © MyBB