Search code examples
phpmysqlselectinformation-schema

Display column names and add check boxes php mysql


I have a task to list the column names with the data type tiny int. I used SHOW COLUMNS but I would like to use the results to make a field in my form based on the show columns result.


Solution

  • Try this:

    SELECT COLUMN_NAME 
    FROM information_schema.COLUMNS 
    WHERE TABLE_SCHEMA = 'dbName' AND TABLE_NAME = 'tableName' AND 
            LOWER(DATA_TYPE) = 'tinyint'