A better way is to use SHOW KEYS
since you don’t always have access to information_schema. The following works:
SHOW KEYS FROM table WHERE Key_name="PRIMARY"
Column_name will contain the name of the primary key.
More Related Contents:
- How can I do ‘insert if not exists’ in MySQL?
- Can’t insert data into mysql database using PHP [closed]
- which is better every user have a table or just a row [closed]
- How can I use PDO to fetch a results array in PHP?
- Fixing broken UTF-8 encoding
- Insert multiple rows with one query MySQL
- MySQL check if a table exists without throwing an exception
- Export MySQL data to Excel in PHP
- MySQL – ignore insert error: duplicate entry
- How to write a stored procedure using phpmyadmin and how to use it through php?
- localhost vs. 127.0.0.1 in mysql_connect()
- “slash before every quote” problem [duplicate]
- Doing calculations in MySQL vs PHP
- Geo-Search (Distance) in PHP/MySQL (Performance)
- Call to a member function execute() on boolean in [duplicate]
- PHP mysql search multiple tables using a keyword
- SQLSTATE[HY000] [1045] Access denied for user ‘username’@’localhost’ using CakePHP
- How to store the data in unicode in hindi language
- PDO + MySQL and broken UTF-8 encoding
- Best practice: Import mySQL file in PHP; split queries
- How to select multiple rows from mysql with one query and use them in php
- php run once and insert twice in mysql database
- Connecting to remote MySQL server using PHP
- Using PHP to execute multiple MYSQL Queries
- split keywords for post php mysql
- Remotely connecting to a MySQL database
- mysql_connect VS mysql_pconnect [closed]
- Strange problem with the length of the field gotten from database [duplicate]
- mysql_fetch_array skipping first row
- 500 Internal Server Error?