Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php joomla 2.5在模块install.mysql.utf8.sql中的工作_Php_Sql_Joomla_Module - Fatal编程技术网

Php joomla 2.5在模块install.mysql.utf8.sql中的工作

Php joomla 2.5在模块install.mysql.utf8.sql中的工作,php,sql,joomla,module,Php,Sql,Joomla,Module,我想安装带有模块的外部sql文件,我遵循这个链接教程,但它不起作用。这是我的xml和sql文件编码。我的错在哪里 <?xml version="1.0" encoding="utf-8"?> <extension type="module" version="2.5.0" client="site" method="upgrade"> <name>practic_module</name> <author>John Doe</au

我想安装带有模块的外部sql文件,我遵循这个链接教程,但它不起作用。这是我的xml和sql文件编码。我的错在哪里

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="2.5.0" client="site" method="upgrade">
<name>practic_module</name>
<author>John Doe</author>
<version>1.0.0</version>
<description>this is a practice module struckture</description>
<files>
<filename>mod_helloworld.xml</filename>
<filename module="mod_helloworld">mod_helloworld.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
</files>
    <config>
<install>
    <sql>
     <file driver="mysql" charset="utf8">sql/mysql/install.mysql.utf8.sql</file>
     <file driver="sqlazure"   charset="utf8">sql/sqlazure/install.sqlazure.utf8.sql</file>
</sql>
</install>

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

<update> 
<schemas>
    <schemapath type="mysql">sql/mysql/updates</schemapath> 
    <schemapath type="sqlazure">sql/sqlazure/updates</schemapath> 
</schemas> 
</update>

<fields name="params">
<fieldset name="basic">
    <field name="lang" type="sql" default="1" label="Select a language" query="SELECT id AS value, lang FROM #__helloworld" />
</fieldset>
</fields>


</config>

</extension>
但它不起作用。数据库未安装。我的错在哪里?请帮助

您已经在标签中添加了,以及不应该添加的标签。他们需要出去。您还需要定义sql文件夹。以下是完整的xml代码:

<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="2.5.0" client="site" method="upgrade">
<name>practic_module</name>
<author>John Doe</author>
<version>1.0.0</version>
<description>this is a practice module struckture</description>

<files>
   <filename>mod_helloworld.xml</filename>
   <filename module="mod_helloworld">mod_helloworld.php</filename>
   <filename>index.html</filename>
   <filename>helper.php</filename>
   <filename>tmpl/default.php</filename>
   <filename>tmpl/index.html</filename>
   <folder>sql</folder>
</files>

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

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

<update> 
<schemas>
    <schemapath type="mysql">sql/mysql/updates</schemapath> 
    <schemapath type="sqlazure">sql/sqlazure/updates</schemapath> 
</schemas> 
</update>

<config>
   <fields name="params">
      <fieldset name="basic">
         <field name="lang" type="sql" default="1" label="Select a language" query="SELECT id AS value, lang FROM #__helloworld" />
      </fieldset>
   </fields>
</config>

</extension>
还要确保文件夹结构正确

希望这有帮助

我想你应该使用config标签

<fields name="params">
  <fieldset name="basic">
  <field name="lang" type="sql" default="1" label="Select a language" query="SELECT id AS value, lang FROM        #__helloworld" />
  </fieldset>
</fields>

在您上传的zip中,清单文件中没有sql-因此安装程序不会在安装时将文件夹复制到模块目录中,也不会执行sql


安装程序:

您需要在文件标签中包含这些文件,如下所示:

<files>
    <!-- The others files that you added -->
    <filename>sql/mysql/install.mysql.utf8.sql</filename>
    <filename>sql/sqlazure/install.sqlazure.utf8.sql</filename>
    <filename>sql/mysql/uninstall.mysql.utf8.sql</filename>
    <filename>sql/sqlazure/uninstall.sqlazure.utf8.sql</filename>
    <filename>sql/sqlazure/updates</filename> <!-- Not sure about this one, sorry -->
</file>

我也在学习,我不知道是否需要更新文件来添加文件标签。结合洛德的回答。希望有用。

C:\xampp\htdocs\joom\modules\mod\u helloworld\mod\u helloworld.php C:\xampp\htdocs\joom\modules\mod\u helloworld\mod\u helloworld.xml C:\xampp\htdocs\joom\modules\modules\mod\u helloworld\helper.php C:\xampp\htdocs\joom\modules\modules\modules\modules\modu helloworld\index.html:\xampp\htdocs\joom\modulesC:\xampp\htdocs\joom\modules\mod\u helloworld\tmpl\index.html C:\xampp\htdocs\joom\modules\mod\u helloworld\sql\mysql\install.mysql.utf8.sql这是我的文件结构。请告诉我我的错误在哪里?这是一个很好的例子。文件夹/文件结构中没有错误。你把我的密码复制粘贴到我的答案里了吗?哈哈,没有,先生。这是我的代码,但它对我不起作用,即使我重新安装xampp softwar,但也不起作用。我能做什么?等待您的帮助您是否可以上载完整模块zip文件的副本。我会为你下载和测试的,先生,这里有什么工具可以上传我的zip吗?如何上传?joomla 3.2下也有同样的问题,基本上与本教程相同。让我吃惊的是,如果不存在,就创建一个表\uuu helloworld该表没有被创建,我得到了这个错误:SQL=SELECT id AS value,来自jos\u helloworld的lang,所以这是某种占位符??你的答案很难理解。你能说清楚一点吗?
<files>
    <!-- The others files that you added -->
    <filename>sql/mysql/install.mysql.utf8.sql</filename>
    <filename>sql/sqlazure/install.sqlazure.utf8.sql</filename>
    <filename>sql/mysql/uninstall.mysql.utf8.sql</filename>
    <filename>sql/sqlazure/uninstall.sqlazure.utf8.sql</filename>
    <filename>sql/sqlazure/updates</filename> <!-- Not sure about this one, sorry -->
</file>