<?php//Table names and table prefixes$tableName = Mage::getSingleton('core/resource')getTableName('catalog_product_entity');// if prefix was 'mage_' then the below statement// would print out mage_catalog_product_entityecho $tableName;//Accessing the database connection resource$read = Mage::getSingleton('core/resource')->getConnection('core_read');$write = Mage::getSingleton('core/resource')->getConnection('core_write');//For a list of functions available, copy the following code into a Magento template.$read = Mage::getSingleton('core/resource')->getConnection('core_read');echo '<pre>';print_r(get_class_methods($read));echo '</pre>';exit;//Reading data from the database$read = Mage::getSingleton('core/resource')->getConnection('core_read');$query = 'SELECT * FROM '. Mage::getSingleton('core/resource')->getTableName('catalog_product_entity');$results = $read->fetchAll($query);print_r($results);//Writing information to the database$write = Mage::getSingleton('core/resource')->getConnection('core_write');// Add your own query below// I didn't add one as I didn't want you to run the code// and me break your database!$query = 'add your query here';$write->query($query);?>
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0 Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/601.5.17 (KHTML, like Gecko) Version/9.1 Safari/601.5.17 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0 Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0;...
Comments
Post a Comment