The best way is to use the INFORMATION_SCHEMA metadata virtual database. Specifically the INFORMATION_SCHEMA.COLUMNS table…
SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`='yourdatabasename' AND `TABLE_NAME`='yourtablename';
It’s VERY powerful, and can give you TONS of information without need to parse text (Such as column type, whether the column is nullable, max column size, character set, etc)…
Oh, and it’s standard SQL (Whereas SHOW ...
is a MySQL specific extension)…
For more information about the difference between SHOW...
and using the INFORMATION_SCHEMA
tables, check out the MySQL Documentation on INFORMATION_SCHEMA
in general…
Related Posts:
- How to log in to phpMyAdmin with WAMP, what is the username and password?
- Should I use mysqli_real_escape string() or mysql_real_escape_string() for form data?
- Fatal error: Call to undefined function mysql_connect()
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- http://localhost:80 is not working on running Apache server through UniServer ZeroXIII
- PDOException SQLSTATE[HY000] [2002] No such file or directory
- Mysql query- How to use contains?
- mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in
- Invalid column count in CSV input on line 1 Error
- Invalid column count in CSV input on line 1 Error
- $wpdb->update or $wpdb->insert results in slashes being added in front of quotes
- PDO with INSERT INTO through prepared statements
- phpMyAdmin: secret passphrase?
- PDO bindParam() with prepared statement isn’t working
- Forbidden :You don’t have permission to access /phpmyadmin on this server
- Creating a search form in PHP to search a database?
- How can I do ‘insert if not exists’ in MySQL?
- Fatal error: Call to a member function bind_param() on boolean [duplicate]
- MySqli Commands out of sync; you can’t run this command now
- Trying to get property of non-object in
- Fix Access denied for user ‘root’@’localhost’ for phpMyAdmin
- Getting connection failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
- Commands out of sync; you can’t run this command now
- Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0
- PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client
- SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
- How can I do ‘insert if not exists’ in MySQL?
- Object of class DateTime could not be converted to string
- What does it mean to escape a string?
- Convert from MySQL datetime to another format with PHP
- MAMP “Apache couldn’t be started because port is in use.” AND “Can’t connect to local MySQL server through /tmp/mysql.sock
- mysqli::query(): Couldn’t fetch mysqli
- Unexpected Exception: SQLSTATE[HY000] [1045] Access denied for user ****@’localhost’ (using password: YES)
- Uncaught Error: Call to undefined function mysql_escape_string()
- Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
- Call to a member function on null?
- SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens on line 102
- Warning: mysqli_query() expects parameter 1 to be mysqli, resource given
- What does MYSQLI_NUM mean and do?
- Mysql where id is in array
- ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it
- What is the advantage of using try {} catch {} versus if {} else {}
- select * from table where column = value ^ column2= value
- Deprecated: mysql_query() [duplicate]
- No query results for model [App\Products] Laravel
- Fatal error: Call to a member function query() on null
- mysqlworkbench giving version error on exporting database
- How to make DROP INDEX IF EXISTS for mysql?
- What is the meaning of sprintf(): Too few arguments
- Having a problem getting mysqli_query to execute
- CodeIgniter: Unable to connect to your database server using the provided settings Error Message
- Can I store images in MySQL
- MySQL Daemon Failed to Start – centos 6
- How to insert TIMESTAMP into my MySQL table?
- How to remove index.php from WordPress site URL
- PHP Like thing similar to MySQL Like, for if statement?
- How get value from URL
- How to use Memcached with PHP7?
- select count(*) from table of mysql in php
- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ””)’ at line 2
- How to set 777 permission on a particular folder? [closed]
- PHP page redirect
- xajax expanding list query
- Data source name not found, and no default driver specified
- Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, object given in
- Illegal string offset Warning PHP
- What’s the purpose of ini_set() in php? (especially for error reporting)
- How to call a JavaScript function from PHP?
- Print array to a file
- I have a string with “\u00a0”, and I need to replace it with “” str_replace fails
- How to find the date of a day of the week from a date using PHP?
- PHP multidimensional array search by value
- Trying to get property of non-object – Laravel 5
- nginx: connect() failed (111: Connection refused) while connecting to upstream – after update nginx –
- How can I capture the result of var_dump to a string?
- Is Angularjs Clientside or Serverside or Both
- Laravel 5 Class ‘Collective\Html\HtmlServiceProvider’ not found on AWS
- Check if URL has certain string with PHP
- Subtracting days, months or years from date using php
- PHP date() format when inserting into datetime in MySQL
- PHP Multiple Checkbox Array
- Session variables not working php
- theme options echoing multiple times
- WordPress 3 – how are passwords stored and how do I compare to them?
- how to echo all tables that start with a prefix
- Display data on Word Press site posts and pages from mysql table
- Accessing data from a non-WP database/table within a page content
- WordPress member notification
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- How does WP work in conjunction with a web server?
- How to unserialize data from MySQL
- SQL error with custom query
- Weird fonts showing which are coming from database
- WordPress Bad Request Error 400
- I am facing this error Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- autocomplete in wordpress using ajax with json-data
- SQL Query Search page
- PHP Creating a formula from mysql db values and db stored math operator
- How to set variable to specific field when querying
- Split Million WordPress Post’s Into Multiple Database Server