Step 1: Initialize a resource object that will communicate with the database.
// To read from the database
$readObject = Mage::getSingleton( 'core/resource' )->getConnection( 'core_read' );
// To write to the database
$writeObject = Mage::getSingleton( 'core/resource' )->getConnection( 'core_write' );
Step 2: Set table name with it's prefix
$dbTable = Mage::getSingleton( 'core/resource' )->getTableName( 'custom_product' );
Step 3: Prepare query
$sql = "SELECT additional_description FROM " . $dbTable . " WHERE id:productId";
$filters = array(
'productId' => $productId
);
Step 4: Run your query.
$result = $readObject->query( $sql, $filters );
while ( $row = $result->fetch() ) {
echo 'Additional Description ' . $row['additional_description'] . '<br />';
}
// To read from the database
$readObject = Mage::getSingleton( 'core/resource' )->getConnection( 'core_read' );
// To write to the database
$writeObject = Mage::getSingleton( 'core/resource' )->getConnection( 'core_write' );
Step 2: Set table name with it's prefix
$dbTable = Mage::getSingleton( 'core/resource' )->getTableName( 'custom_product' );
Step 3: Prepare query
$sql = "SELECT additional_description FROM " . $dbTable . " WHERE id:productId";
$filters = array(
'productId' => $productId
);
Step 4: Run your query.
$result = $readObject->query( $sql, $filters );
while ( $row = $result->fetch() ) {
echo 'Additional Description ' . $row['additional_description'] . '<br />';
}
Plugin Company
ReplyDeleteEasily create any type of Magento contact form with simple drag & drop form builder, 100’s design options and custom e-mail notifications!
Mason Munter
1050 McVaney Road
Asheville, NC 28801
masonmunter@gmail.com
828-257-8345