Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with read default value

Status
Not open for further replies.

soasi

Programmer
Apr 6, 2005
1
PL
Please help me if you can

I have table with simple data. all of fields have default value

how to read this default value, using php

thanks for help
 
The values used for defaults are stored in the data dictionary, also known as the INFORMATION_SCHEMA. See

From that resource I learned that you can find the default for a column with this query.
Code:
SELECT COLUMN_NAME, COLUMN_DEFAULT
  FROM INFORMATION_SCHEMA.COLUMNS
  WHERE table_name = 'tbl_name'
  [AND schema_name = 'db_name']
  [AND column_name LIKE 'wild']

The clauses in brackets are optional. Also there should be a way to get the same information from the SHOW command.
Code:
SHOW COLUMNS
  FROM tbl_name
  [FROM db_name]
  [LIKE wild]

Hope I understood your question and that this is helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top