0

I need to insert a value into the database. The table already exists, just insert one more enter image description here

And I need Insert 9 newcode newcode_title I created new file

mysql4-upgrade-0.7.9-0.8.0.php

And it includes

<?php

$installer = $this;

$installer->startSetup();

???????????
$installer->endSetup();

1 Answer 1

1

You can try:

$installer->startSetup();
$installer->getConnection()->addColumn($installer->getTable('[YOUR TABLE]'),'new_column', array(
'type'      => Varien_Db_Ddl_Table::TYPE_TEXT,
'nullable'  => false,
'length'    => 255,
'after'     => null,
'comment'   => 'New column'
)); 
$installer->endSetup();

EDIT:

To insert data to your table you must create a model in your module and call the save action:

$model = Mage::getModel('modulename/modelname');
$model->setData($yourData);
$model->save();
3
  • Ty for answer.U add new column, but I need just a new value of the table. For example id picture_code picture_code_tittle 9 newcode newcodetitle Commented Mar 12, 2018 at 8:42
  • if I have AI id, I shouldn't include it at the $yourData? Commented Mar 12, 2018 at 9:05
  • If it's autoincrement you don't have to add an id.
    – Adrian Z.
    Commented Mar 12, 2018 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.