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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if coulumn exists 1

Status
Not open for further replies.

smashing

Programmer
Oct 15, 2002
170
0
0
US
Quering a MySQL database with PHP, is it possible to find out if a particular column exists in a table, without outputing an error if in fact there is no column by such name?
 
You can always inspect the table structure with a query, e.g. "SHOW COLUMNS FROM `myTable`".

Also:
The very broad query "SELECT * FROM `myTable`" returns all columns. You could then inspect the returned data for existence of that column.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top