I have a model and I was trying to add a model to the database. When I execute the php script to add everything works fine and no exception are thrown. But the data is not added to the database, which i verified with mysql.
I tried to track the mysql queries and find that in both the cases, setData and addData, Magento is calling an Update command not Insert command. Why is it behaving like this? Is it possible that this behaviour is because of model implementation?
Code snippet to add data -
$data = array('appid'=>'new_appid','custid'=>1,'info'=>'info');
$model = Mage::getModel('interface/data')->setData($data);
try {
$insertid = $model->save()->getId();
echo "Data Succesfull inserted. Insert Id : ".$insertid;
}
catch (Exception $e){
echo $e->getMessage();
}