The user is presented with a list of all items in the database. The list only displays the id and the name and a show more button is displayed beside each item and when the user presses the show more button of a single item another form showing all fields is displayed. Ex: Id,name, status, …., …. Etc.. as I’m fetching the data by the id from mysql all fields including the empty ones are displayed. I need to hide the empty column to that specific item.
OK, so your "table" for each item really only contains a header row and a single row for the item info, correct?
Which begs the question you didn't answer yet: how are you creating the HTML from the item data? It seems a simple matter of not creating the <th> and <td> elements for the columns that have no data, but the specifics depend on what you're using.