简体   繁体   中英

How to fetch all columns of table except one

I am fetching data from product detail table but i don't want to fetch all the columns from the table as i want to make a dynamic product detail page which will display the data directly from the table whenever we add a new column so that we don't have to make any changes in the code.

This is where the data getting display

这是数据获取显示的地方

Reference for the table of product detail

产品明细表参考

You have a horrible table structure. Try something like this...

id, field_name, data

CREATE TABLE `fieldstore` (
  `id` int(11) NOT NULL,
  `field_name` varchar(100) NOT NULL,
  `field_data` varchar(200) NOT NULL
)

Example data: 1, "blend", "bamboo" (The 1 is of course auto-increment).

This way, you can have an unlimited number of field names without having to alter your table structure every time you wanted to add a new column.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM