kixe Posted March 13, 2015 Posted March 13, 2015 How can I get the index type of a mysql database table with pw-api? The Following doesn't work. Why? $table = 'pages'; $column = 'pages_id'; $sql1 = $db->query("SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$column'"); $options = array(); while ($row = $sql1->fetch_array()) $options[] = $row; var_dump($options); // return empty array
nickie Posted March 13, 2015 Posted March 13, 2015 pages_id is not a column in pages, I think you are looking for 'id'. Results for query('SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='pages'): +-------------------+ | COLUMN_NAME | +-------------------+ | id | | parent_id | | templates_id | | name | | status | | modified | | modified_users_id | | created | | created_users_id | | sort | +-------------------+ 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now