I'm trying to DESCRIBE a table in joomla 3.x I want to get the column names and the associated details (type etc) into an array.

I want to get

Name Type Collation Attributes Null Default Comments Extra

for any given table

I can't find anything in Joomla that tells me how to do that I think the way to go is to use DESCRIBE but I can't find anything in the API that allows me to do DESCRIBE. I've tried lots of ways of getting the info but no success e.g:

$db = JFactory::getDbo();
$query = $db->getQuery(true);   
$query = "DESCRIBE `##__table_person`";
$row = $db->loadObjectList($query);
/*while($row ) {
    echo "{$row['Field']} - {$row['Type']}\n";
print "<pre>";
print "</pre>";

1 Answer 1


This will return an array of objects:

$db = JFactory::getDbo();
$result = $db->setQuery('DESCRIBE ' . $db->quoteName('#__table_person'))->loadObjectList();

Use loadAssocList() instead of loadObjectList() to return an array of associated arrays.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.