tags:

views:

41

answers:

1

in php,there is a simple listing page.in listing page we can not display all the columns from database.i want to give functionality of add/remove/hide columns.

A: 

Assuming you are using MySQL. You can use this query

SELECT column1,column2.... FROM `table`
Shubham
He can even use SELECT * then displaying only the columns that matches the current settings.
fabrik
@fabrik it is generally better to only fetch what is needed. If you only need three columns from a 20 column table containing large columns like CLOBs and stuff, you would fetch way more (often over the network when the db is on a remote server) than needed, slowing down your app for nothing.
Gordon
@Gordon Of course you're right but because the OP didn't specified anything concrete (These columns removed dynamically with JavaScript for example?) it was an idea only.
fabrik