[TYPO3-dev] A way to detect if table has a certain field
Oliver Hader
oh at inpublica.de
Thu Sep 27 16:18:39 CEST 2007
Hi Tapio,
Tapio Markula schrieb:
> Is there any core function to detect if the table has certain field.
> I would need to know if table has fieds 'pid' and 'deleted'
If the field is defined in $TCA you could do:
t3lib_div::loadTCA('myTable');
if (isset($GLOBALS['TCA']['myTable']['columns']['myField'])) {
// Field 'myField' of table 'myTable' was defined in $TCA
}
If the field you're looking for isn't defined in $TCA, e.g. 'uid', you
could use a SQL query like:
DESCRIBE myTable myField
If the field is found, there'll be a result row.
olly
--
Oliver Hader
http://inpublica.de/
More information about the TYPO3-dev
mailing list