This works well for me.
SHOW COLUMNS FROM `table` LIKE 'fieldname';
With PHP it would be something like…
$result = mysql_query("SHOW COLUMNS FROM `table` LIKE 'fieldname'");
$exists = (mysql_num_rows($result))?TRUE:FALSE;
More Related Contents:
- Delete the entire content of all table in a Database [closed]
- MyISAM versus InnoDB [closed]
- Calculate a running total in MySQL
- How do I find the MySQL my.cnf location
- How to change MySQL data directory?
- MySQL Syntax error message “Operand should contain 1 column(s)”
- GROUP_CONCAT ORDER BY
- MySQL: ALTER TABLE if column not exists
- MySQL SELECT increment counter
- Prevent auto increment on MySQL duplicate insert
- Query from two tables in report
- MySQL – force not to use cache for testing speed of query
- Is it safe to store usernames and passwords in the database?
- How do I know when my docker mysql container is up and mysql is ready for taking queries?
- How to count all rows when using SELECT with LIMIT in MySQL query?
- MySQL FULL JOIN?
- How to fix double-encoded UTF8 characters (in an utf-8 table)
- How to integrate ElasticSearch with MySQL?
- MySQL INSERT INTO … VALUES and SELECT
- MySQL LOAD_FILE() loads null values
- What are practical differences between `REPLACE` and `INSERT … ON DUPLICATE KEY UPDATE` in MySQL?
- MySQL Select ID’s which occur on different rows with multiple specific values for a column
- How to compare timestamp dates with date-only parameter in MySQL?
- How to sort a MYSQL table in a permanent way?
- UPDATE with ORDER BY and LIMIT not working in MYSQL
- Equivalent of MSSQL IDENTITY Column in MySQL
- #1060 – Duplicate column name ‘id’
- Update multiple rows with multiple ‘where’ clauses for each individual row
- WHERE datetime older than some time (eg. 15 minutes)
- Is there a way to use ON DUPLICATE KEY to Update all that I wanted to insert?