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:
- Insert into a MySQL table or update if exists
- “Incorrect string value” when trying to insert UTF-8 into MySQL via JDBC?
- WHERE vs HAVING
- How to do Inheritance Modeling in Relational Databases?
- MySQL error 1449: The user specified as a definer does not exist
- MySQL – UPDATE query with LIMIT
- Differences between utf8 and latin1
- phpMyAdmin on MySQL 8.0 [duplicate]
- MySQL stored procedures use them or not to use them
- Change decimal separator in MySQL
- SQL query of multiple values in one cell
- Fetching linked list in MySQL database
- How to skip certain database tables with mysqldump?
- Using MySql with Entity Framework 4 and the Code-First Development CTP
- How can I correct MySQL Load Error
- Using ALTER to drop a column if it exists in MySQL
- Count number of unique values
- ‘Access denied for user ‘root’@’localhost’ (using password: NO)’
- MySQL treats ÅÄÖ as AAO?
- How to transpose rows to columns with large amount of the data in BigQuery/SQL?
- Count with IF condition in MySQL query
- How to Prevent Connection Timeouts for Large MySQL Imports
- Can I launch a trigger on select statement in mysql?
- Strings as Primary Keys in MYSQL Database [closed]
- How to use MySQL DECIMAL?
- MySQL: return updated rows
- SQL doesnt differentiate u and ü although collation is utf8mb4_unicode_ci
- Laravel Eloquent Ignore Casing
- How to get back Lost phpMyAdmin Password, XAMPP
- ERROR 1115 (42000): Unknown character set: ‘utf8mb4’