duannao1920 2013-08-22 01:32
浏览 37
已采纳

创建joomla模块以执行简单查询并显示结果

Besides the tables of joomla, I create my own table in the same database joomla!

Now I wanted to create a module, which made ​​the selection of this table and show. How can I do this!

Table FRUITS

ID | NAME
1 | apple
2 | orange
3 | banana

I have already created the structure of the module! Now I lack the build file:

  • helper.php
  • tmpl / default.php
  • 写回答

2条回答 默认 最新

  • duanpiyao2734 2013-08-22 03:12
    关注

    Try this,

    Inside your helper.php

    function GetDetails(){
      $db = JFactory::getDBO();
      $sql= "SELECT * FROM FRUITS";
      $db->setQuery($sql);
      $db->query();
      $res = $db->loadAssocList();
      return $res;
    }
    

    and in your mod_ file have call to this function like

    $result = class_name :: GetDetails();
    //$result is available in your default.php
    

    For more about module development in joomla.

    Hopes its help you..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀