It seams I can't get the table from my custom database.
My module should list all data from the database frontend(and backend later) But I get this error
a:5:{i:0;s:93:"SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ifp.mage_emailorder' doesn't exist";i:1;s:4318:"#0 /var/www/ifp.dk/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
What I can read on the net. Eather its the database setup, or the block I use to call it out.
Database setup
app/code/local/Puk/EmailOrder/sql/emailorder_setup/mysql-install-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
$sql=<<<SQLTEXT
create table emailorder(
emailorder_id int not null auto_increment,
order_date varchar(255) not null,
product_name varchar(255) not null,
location varchar(255) not null,
date_for varchar(255) not null,
name_title varchar(100) not null,
email varchar(255) not null,
company varchar(255) not null,
adress varchar(255) not null,
zipcode varchar(255) not null,
city varchar(255) not null,
phone varchar(255) not null,
comment text not null,
order_done int not null default 0,
primary key(emailorder_id)
);
SQLTEXT;
$installer->run($sql);
//demo
//Mage::getModel('core/url_rewrite')->setId(null);
//demo
$installer->endSetup();
The block
app/code/local/EmailOrder/Block/Monblock.php
<?php
class Puk_EmailOrder_Block_Monblock extends Mage_Core_Block_Template
{
public function methodblock()
{
$retour='';
$collection = Mage::getModel('emailorder/emailorder')->getCollection()
->setOrder('emailorder_id','asc');
foreach($collection as $data)
{
$retour .= $data->getData('product_name').' '.$data->getData('location')
.' '.$data->getData('date_for').'<br />';
}
Mage::getSingleton('adminhtml/session')->addSuccess('YES!');
return $retour;
}
}
Can someone help? :)