S
S
Stanislav2018-04-15 04:01:24
PHP
Stanislav, 2018-04-15 04:01:24

Is it possible to know enum values ​​from default in struct?

There is a table structure that has an enum field, let's call it numbers, for example. The default is '0','1','2','3','4','5'. Is it possible to find out from PHP what and how many enums are in this field?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2018-04-16
@xynd3r

select COLUMN_TYPE from information_schema.columns where table_schema='db_name' and table_name='table_name' and COLUMN_NAME='numbers'"

example output
array(1) {
  [0]=>
  array(1) {
    ["COLUMN_TYPE"]=>
    string(78) "enum('Queued','Delayed','Processing','Completed','Paused','Error','Cancelled')"
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question