I’m doing a function that after the user saves the product it updates or inserts the product in a table, but to know if magento has to update or insert I have to verify if the product is in the table, when I do the select query I’m obtaining nothing in my variables
Here’s my code
$resource = Mage::getSingleton('core/resource');
$readConnection = $resource->getConnection('core_read');
$tabla = $resource->getTableName('_destacados_web');
$querySelect = "SELECT DCOD, DCATEGORIA FROM ".$tabla." WHERE DMARCA = '".$partesSku[0]."' AND DITEM = '".$partesSku[1]."'";
$results = $readConnection->fetchAll($querySelect);
$codigo = $results['DCOD'];
$categoria= $results['DCATEGORIA '];
As you can see, the idea it’s really simple, just obtaining two rows of my table and saving that into the variables, but every time I run the code I get nothing in the variables,
I hope you guys can help me! Thanks
INSERT..ON DUPLICATE KEY UPDATE..
. Just make sure you set a unique key on theDMARCA
andDITEM
columns.