执行此功能时出错

执行此功能时出错

本文介绍了执行此功能时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从。

这是函数,$ data来自...。

This is the function, from which the $datais coming..

function getSearchedUniversityTab($country, $state, $level, $degType) {
      $query = $this->db->query("SELECT `university`.`uniId`, `university`.`name`
                                FROM (`university`)
                                inner JOIN (select degCollege, degType, count(*) as cnt  from degree where `degType` =  '$degType'  group by degCollege) clg
                                ON clg.`degCollege` = `university`.`uniId` 
                                WHERE `country` =  '$country'
                                AND `state` =  '$state'");
      $result = $query->result_array();

      foreach($result as $row)
      {
        $data[] = $row;
      }
      return $data;
      $this->db->close();  
   }


推荐答案

$ c> result 返回空
更改为

Most probable your result is returning emptyChange to

function getSearchedUniversityTab($country, $state, $level, $degType) {
      $query = $this->db->query("SELECT `university`.`uniId`, `university`.`name`
                                FROM (`university`)
                                inner JOIN (select degCollege, degType, count(*) as cnt  from degree where `degType` =  '$degType'  group by degCollege) clg
                                ON clg.`degCollege` = `university`.`uniId` 
                                WHERE `country` =  '$country'
                                AND `state` =  '$state'");
      $result = $query->result_array();
     if(count($result) > 0 ) {
      foreach($result as $row)
      {
        $data[] = $row;
      }

      return $data;
     }else{
       return null;
     }
      $this->db->close();  
   }

这篇关于执行此功能时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 13:33