Explorar o código

Fix for sql_mode=only_full_group_by

In MySQL 5.7, the default is sql_mode=only_full_group_by
Visman %!s(int64=5) %!d(string=hai) anos
pai
achega
5aca7b110d
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      app/Models/Topic/Model.php

+ 3 - 3
app/Models/Topic/Model.php

@@ -297,14 +297,14 @@ class Model extends DataModel
             ':tid' => $this->id,
             ':tid' => $this->id,
             ':pid' => $pid,
             ':pid' => $pid,
         ];
         ];
-        $sql = 'SELECT COUNT(p.id) AS num, j.id AS flag
+        $sql = 'SELECT COUNT(p.id) AS num
                 FROM ::posts AS p
                 FROM ::posts AS p
                 INNER JOIN ::posts AS j ON (j.topic_id=?i:tid AND j.id=?i:pid)
                 INNER JOIN ::posts AS j ON (j.topic_id=?i:tid AND j.id=?i:pid)
-                WHERE p.topic_id=?i:tid AND p.id<?i:pid';
+                WHERE p.topic_id=?i:tid AND p.id<?i:pid'; //???? может на два запроса разбить?
 
 
         $result = $this->c->DB->query($sql, $vars)->fetch();
         $result = $this->c->DB->query($sql, $vars)->fetch();
 
 
-        $this->page = empty($result['flag']) ? null : (int) \ceil(($result['num'] + 1) / $this->c->user->disp_posts);
+        $this->page = empty($result) ? null : (int) \ceil(($result['num'] + 1) / $this->c->user->disp_posts);
     }
     }
 
 
     /**
     /**