Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.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
从joomla 2.5中的数据库检索数据_Joomla - Fatal编程技术网

从joomla 2.5中的数据库检索数据

从joomla 2.5中的数据库检索数据,joomla,Joomla,我有两张桌子: agahi:(agahi_id,ostan,car_id,published) 用户_agahi(用户_agahi,奥斯坦,塔拉菲阿加希用户,已发布) 我使用下面的代码,但我无法检索数据 class modostanHelper { public function retrieve() { $db=JFactory::getDBo(); $sql="create view agahi

我有两张桌子:

  • agahi:(agahi_id,ostan,car_id,published)

  • 用户_agahi(用户_agahi,奥斯坦,塔拉菲阿加希用户,已发布)

我使用下面的代码,但我无法检索数据

class modostanHelper
{

          public function retrieve()
          {
              $db=JFactory::getDBo();
            $sql="create view agahi as(select ostan,count(id_useragahi) as text_agahi from #__npco_useragahi where published=1 group by ostan) ";

              $db->setQuery($sql);

                           $db=JFactory::getDBo();
              $sql_1="create view useragahi AS (select ostan,count(id_agahi) as text_useragahi from #__npco_agahi where published=1 group by ostan) ";
              $db->setQuery($sql_1);

                          $db=JFactory::getDBo();
                     $sql_2="select * from agahi,useragahi where agahi.ostan=useragahi.ostan";
                         $db->setQuery($sql_2);                          
                return $db->loadAssocList();


            }
}
在文件
default.php
中,我使用下面的代码

之后

$db=JFactory::getDBo();


        $sql="create view agahi as(select ostan,count(id_useragahi) as text_agahi from #__npco_useragahi where published=1 group by ostan) ";

          $db->setQuery($sql);
执行查询:

$db->query()