Magento
INSERT DATA
$data contains array of data to be inserted. The key of the array should be the database table’s field name and the value should be the value to be inserted.
$data = array ( 'title' => 'hello there' , 'content' => 'how are you? i am fine over here.' , 'status' =>1); $model = Mage::getModel( 'mynews/mynews' )->setData( $data ); try { $insertId = $model ->save()->getId(); echo "Data successfully inserted. Insert ID: " . $insertId ; } catch (Exception $e ){ echo $e ->getMessage(); } SELECT DATA $item->getData() prints array of data from ‘news’ table.
UPDATE DATA $id is the database table row id to be updated.
DELETE DATA $id is the database table row id to be deleted.
|