Skip to content
Advertisement

Get mysql table field names in ZF2

I want to store the csv data dynamically into mysql table. According to my csv columns header i want to insert the data into respective columns in mysql table. For this, I need to get all the table fields name from Zend Framework Controller or Model.

I have tried with:

**

$metadata = new ZendDbMetadataMetadata($adapter);
$table = $metadata->getTable($tableName);
$table->getColumns();

**

But, it shows the error:

Fatal error: Class ‘ImportModelZendDbMetadataMetadata’ not found.

How can I get all the mysql table fields name using Zend Framework 2?

Advertisement

Answer

you have to use a backslash before zend correct one :

$metadata = new ZendDbMetadataMetadata($adapter);
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement