-1

In php I have a function and inside that function I have one query like this

  public function hookHome($params)
  {
    $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
    global $cookie, $smarty;
    $value=array();
    $sql_select="SELECT DISTINCT country_name,country_ISO from "._DB_PREFIX_."storeinfo where status='1'";
    $result=Db::getInstance()->ExecuteS($sql_select);
      while($row=mysql_fetch_assoc($result))
      {
        $value[] = $row;
      }
     $smarty->assign('array',$value);
     $smarty->assign('default',$defaultLanguage);
  }

But after execution of query it is showing an error like Warning: mysql_fetch_array() expects parameter 1 to be resource, array given in storeinfo.php on line 8;

So can here some one kindly tell me what is the issue here? Any help and suggestions will be really appreciable. Thanks

cha
  • 734
  • 2
  • 11
  • 26
user159377
  • 119
  • 1
  • 3

1 Answers1

1

your code $result=Db::getInstance()->ExecuteS($sql_select); is returning an array. you need a mysql_resultset to be passed into mysql_fetch_assoc.

it seems that your using some library that is wrapped around the mysql extension. You should check to see what it returns and maybe it self has a method to iterate through results.

DevZer0
  • 13,316
  • 6
  • 25
  • 50