简体   繁体   中英

Create table during joomla module installation

i'm currently working on a joomla module (using joomla 2.5), and I have to create a table to use it.

i follow this tutorial : http://docs.joomla.org/J2.5:Creating_a_simple_module/Developing_a_Basic_Module but when i install it, the table is not created.

here is my xml file :

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="2.5.0" client="site" method="upgrade">
<name>Valid Order Module</name>
<author>Mathiewz</author>
<version>1.0.0</version>
<description>Module de validation des commandes !</description>
<files>
    <filename module="mod_valid_order">mod_valid_order.php</filename>
    <filename>index.html</filename>
    <filename>helper.php</filename>
    <filename>search.php</filename>
    <filename>export_gc.php</filename>
    <folder>tmpl</folder>
    <folder>img</folder>
    <folder>sql</folder>
</files>

<install>
    <sql>
        <file driver="mysql">sql/install.sql</file>
    </sql>
</install>
<update>
    <sql>
        <file driver="mysql">sql/install.sql</file>
    </sql>
</update>
<uninstall>
    <sql>
        <file driver="mysql">sql/uninstall.sql</file>
    </sql>
</uninstall>
<config>
</config>
</extension>

i tried my sql request on phpmyadmin directly and it works, so i presume the problem is in the xml file

You have missed out the charset"" parameter. Try using the following:

<install>
    <sql>
         <file driver="mysql" charset="utf8">sql/install.sql</file>
    </sql>
</install>

This is exactly what we use for our extensions, so it should work.

Hope this helps

okay, i find the problem.

The table wasn't created because i didn't made propers uninstall before reinstall the module...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM