how to get the column name from table in mysql php code example

Example 1: mysql find tables with column name

SELECT DISTINCT TABLE_NAME 
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE COLUMN_NAME IN ('columnA','ColumnB')
        AND TABLE_SCHEMA='YourDatabase';

Example 2: how to output a different column name in mysql

-- MySQL

SELECT column1 AS name1, column2 AS name2
FROM table1;

-- AS allows your to replace the name of a column when outputting but does not
-- actually change the column name within the database.

Example 3: php select data from mysql database without column name

SHOW COLUMNS FROM table_name;

Tags:

Php Example