Mohammad Ali
Mohammad Ali

Reputation: 153

What’s wrong with this module in Joomla 3.x?

I’m trying to complete this tutorial with Joomla!: https://docs.joomla.org/J3.x:Creating_a_simple_module/Using_the_Database

mod_helloworld.xml is like this:

……

  <description>A simple Hello, World! module.</description>
  <install>
    <sql>
      <file driver="mysql" charset="utf8">sql/mysql/install.mysql.utf8.sql</file>
     </sql>
  </install>
  <scriptfile>script.php</scriptfile>

………..

And I have made this folders: (root of my module)/sql/mysql And I have made the "install.mysql.utf8.sql" file on it with the following content:

CREATE TABLE IF NOT EXISTS `#__helloworld` (
    `id` int(10) NOT NULL AUTO_INCREMENT,
    `hello` text NOT NULL,
    `lang` varchar(25) NOT NULL,

  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;

INSERT INTO `#__helloworld` (`hello`, `lang`) VALUES ('Hello World', 'en-GB');
INSERT INTO `#__helloworld` (`hello`, `lang`) VALUES ('Hola Mundo', 'es-ES');
INSERT INTO `#__helloworld` (`hello`, `lang`) VALUES ('Bonjour tout le monde', 'fr-FR');

But when I tried to install my module, I received this error:

Warning JInstaller: :Install: Error SQL DB function reports no errors. Extension Install: SQL error processing query: DB function reports no errors.

Error Error installing module

Upvotes: 2

Views: 186

Answers (1)

Mohammad Ali
Mohammad Ali

Reputation: 153

I would add these lines in mod_helloworld.xml to resolve this

<files>
    <folder>sql/mysql</folder>
</files>

Upvotes: 1

Related Questions