title: Syntax error near 'rows FROM `#__whmportfolio_item` AS a WHERE a.cate in (4)' at line 1
body: <p>I have moved the site from server that have mysql server to other one that have MariaDB server version also the site was working without issue on the old server </p>
  
  <p>But on new one I got this error : </p>
  
  <blockquote>
    <p>1064 You have an error in your SQL syntax; check the manual that
    corresponds to your MariaDB server version for the right syntax to use
    near 'rows FROM <code>#__whmportfolio_item</code> AS a WHERE a.cate in (4)' at
    line 1</p>
  </blockquote>
  
  <p>this is the helper cod of the module:</p>
  
  <pre><code>&lt;?php
  
      class ModWhmPortfolioHelper
      {
          public static function toggleVoteAjax() {
          $db = JFactory::getDbo();
          $u = WhmportfolioFrontendHelper::getUid();
          $pfid = JRequest::getInt('pfid', 0);
          if(!$pfid) {
              return null;
          }
          $rs = $db
          -&gt;setQuery("SELECT id FROM #__whmportfolio_liked WHERE u = '{$u}'")
          -&gt;loadObject();
          if(is_null($rs)) {
              $db
              -&gt;setQuery("INSERT INTO #__whmportfolio_liked(pfid, u) VALUES ({$pfid}, '{$u}')")
              -&gt;execute();
          }
          else {
              $db
              -&gt;setQuery("DELETE FROM #__whmportfolio_liked WHERE id = {$rs-&gt;id}")
              -&gt;execute();
          }
  
          return $db
          -&gt;setQuery("SELECT count(*) as c FROM #__whmportfolio_liked WHERE u = '{$u}'")
          -&gt;loadObject()-&gt;c;
      }
  
      public static function getItems($cate, $tag, $offset, $limit, $isize='0x0'){
          $db = JFactory::getDbo();
          $uid = WhmportfolioFrontendHelper::getUid();
          $where = "";
          if($tag || $cate) {
              $where = "WHERE ";
              if($tag) {
                  $tag = implode(',', $tag);
                  $where .= "a.tag in ({$tag})";
              }
              if($tag &amp;&amp; $cate) {
                  $where .= " AND ";
              }
              if($cate) {
                  $cate = implode(',', $cate);
                  $where .= "a.cate in ({$cate})";
              }
          }
          $q = 'SELECT DISTINCT a.*,'.
              "(select count(*) from #__whmportfolio_liked as l where l.pfid = a.id) as cliked,".
              "(select count(*) from #__whmportfolio_liked as l where l.u = '{$uid}') as lactive
              FROM `#__whmportfolio_item` AS a
              {$where}
              ORDER BY a.id DESC";
          $rs = $db-&gt;setQuery($q, $offset, $limit)-&gt;loadObjectList();
          if(is_null($rs)) return 0;
  
          foreach($rs as &amp;$item) {
              WhmportfolioFrontendHelper::build($item, $isize);    
          }
  
          $q = "SELECT DISTINCT count(*) as rows FROM `#__whmportfolio_item` AS a {$where}";
          return (object)array('items'=&gt;$rs, 'total'=&gt;$db-&gt;setQuery($q)-&gt;loadObject()-&gt;rows);
      }
  
  
      }
  
  ?&gt;
  
  
  
  </code></pre>