1

Here are all my files.

app/code/local/Vlabs/Productquery/sql/productquery_setup/resource-install-0.1.0.php

<?php
  $installer = $this;
  $installer->startSetup();

 $installer->run("
  -- DROP TABLE IF EXISTS {$this->getTable('Vlabs_queryBox')};
    CREATE TABLE {$this->getTable('Vlabs_queryBox')} (
      `id` int(11) unsigned NOT NULL auto_increment,
      `name` varchar(255) NOT NULL default,
      `email`  varchar(255),
      `query`  varchar(255),
      `product_name` varchar(255),
      `sku` varchar(255),
      `answer` varchar(255),
      `status` varchar(255),
      `date` date NULL,
       PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  ");

  $installer->endSetup();

app/code/local/Vlabs/Productquery/etc/config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Vlabs_Productquery>
            <version>0.1.0</version>
        </Vlabs_Productquery>
    </modules>

    <frontend>
        <routers>
            <productquery>
                <use>standard</use>
                <args>
                    <module>Vlabs_Productquery</module>
                    <frontName>productquery</frontName>
                </args>
            </productquery>
        </routers>
        <layout>
            <updates>
                <productquery module="Vlabs_Productquery">
                    <file>productquery.xml</file>
                </productquery>
            </updates>
        </layout>
    </frontend>

    <global>
        <blocks>
            <productquery>
                <class>Vlabs_Productquery_Block</class>
            </productquery>
        </blocks>

        <models>
            <productquery>
                <class>Vlabs_Productquery_Model</class>
                <resourceModel>productquery_Resource</resourceModel>
            </productquery>
            <productquery_Resource>
                <class>Vlabs_Productquery_Model_Resource</class>
                <entities>
                    <querybox>
                        <table>Vlabs_queryBox</table>
                    </querybox>
                </entities>
            </productquery_Resource>
        </models>
         <helpers>
          <productquery>
            <class>Vlabs_Productquery_Helper</class>
          </productquery>
        </helpers>
        <resources>
            <form_setup>
                <setup>
                    <module>Vlabs_Productquery</module>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </form_setup>
            <form_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </form_write>
            <form_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </form_read>
        </resources>
        <template>
        <email>
            <vlabs_query_email_template translate="label">
                <label>Recurring order email</label>
                <file>vlabs_querybox_email.html</file>
                <type>html</type>
            </vlabs_query_email_template>
        </email>
    </template>   
    </global>

     <!-- <default>
        <productquery>
            <settings>
                <enable>1</enable>              
            </settings>
        </productquery>
    </default> -->

    <admin>
        <routers>
            <adminhtml>
                <use>admin</use>
                <args>
                    <modules>
                        <Vlabs_Productquery before="Mage_Adminhtml">Vlabs_Productquery_Adminhtml</Vlabs_Productquery>
                    </modules>
                    <frontname>productquery</frontname>
                </args>
            </adminhtml>
        </routers>
    </admin> 
    <adminhtml>
        <layout>
            <updates>
                <productquery>
                    <file>productquery.xml</file>
                </productquery>
            </updates>
        </layout>
    </adminhtml>   
</config>   

app/code/local/Vlabs/Productquery/Model/Resource/Querybox/Setup.php

<?php 
class Vlabs_Productquery_Model_Resource_Querybox_Setup extends Mage_Core_Model_Resource_Setup {
}

Error

a:5:{i:0;s:179:"SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento_mirror_new.Vlabs_queryBox' doesn't exist, query was: SELECT `main_table`.* FROM `Vlabs_queryBox` AS `main_table`";i:1;s:5763:"#0 /var/www/html/magento-mirror-new/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)

I am working on making an extension.. But table is not created in database. But query is working when run this query direct in mysql. How can I resolve this problem?

1 Answer 1

1

It seems like you have installed your module and later you changed the database name.

Go to core_resource table and try to delete this entry "form_setup". Then clear cache and try again. I hope this will work.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you Jickson Johnson Koottala. I have deleted "form_setup" table. and then clear cached. But it is not working still now.
@Mayuri noticed one thing with the setup folder name. I think it should be "form_setup" instead of "productquery_setup". Could you please try this

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.