magento db query directly


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* Snipset for db query */
  2.  
  3. $dbConf = Mage::getConfig()->getNode('global/resources/default_setup/connection');
  4. $db = new Zend_Db_Adapter_Pdo_Mysql(array('host'=> $dbConf->host, 'username' => $dbConf->username, 'password' => $dbConf->password, 'dbname'=> $dbConf->dbname));
  5. $link_data = array(
  6. 'product_id' => $product->getId(),
  7. /* etc... */
  8. );
  9. $db->insert('catalog_product_link',$link_data);
  10. $db->closeConnection();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.