Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

magento2 join table with prefix

function getColumns($table,$prefix)
{
    $resource = $GLOBALS['obj']->get('MagentoFrameworkAppResourceConnection');
    $connection = $resource->getConnection();
    $sql = "SHOW COLUMNS FROM `$table`;";
    echo $sql;
    $result = $connection->fetchAll($sql);
    $columns = array();
    for ($i = 0; $i < count($result); $i++) {
        array_push($columns,$result[$i]['Field']." as ".$prefix.$result[$i]['Field']);
    }
    return $columns;
}
 
PREVIOUS NEXT
Tagged: #join #table #prefix
ADD COMMENT
Topic
Name
9+8 =