0

We have 'outofstocksubscription_info' table in database. We want to it's all data in one custom php file. How to get it in custom file ?

1 Answer 1

2
$resource = Mage::getSingleton('core/resource');

    /**
     * Retrieve the read connection
     */
    $readConnection = $resource->getConnection('core_read');

    $query = 'SELECT * FROM ' . $resource->getTableName('outofstocksubscription_info');

    /**
     * Execute the query and store the results in $results
     */
    $results = $readConnection->fetchAll($query);

    /**
     * Print out the results
     */
     var_dump($results);

reference

5
  • Thanks; its working. But in this table multiple columns and we want only 2 column value. I am not more familiar with coding.
    – Anil
    Commented Jun 25, 2019 at 11:12
  • replace 'select * from' with 'select column1name,column2name from'
    – jscar
    Commented Jun 25, 2019 at 11:14
  • 1
    in select query instead * you can use column name like: name, surname Commented Jun 25, 2019 at 11:14
  • @JimitBhavsar thanks it's working.
    – Anil
    Commented Jun 25, 2019 at 11:31
  • @JimitBhavsar this array has multi product SKU; and some are repeat in it. How to count it.
    – Anil
    Commented Jun 25, 2019 at 12:16

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.