Skip to content

Instantly share code, notes, and snippets.

@levidurfee

levidurfee/error.txt

Created Dec 21, 2020
Embed
What would you like to do?
ExpressionEngine 2 incompatibility with MySQL 5.7.x
A Database Error Occurred
Error Number: 3065
Expression #1 of ORDER BY clause is not in SELECT list, references column ‘txx_db.exp_channel_titles.entry_date’ which is not in SELECT list; this is incompatible with DISTINCT
SELECT DISTINCT exp_channel_titles.entry_id FROM (`exp_channel_titles`) WHERE exp_channel_titles.site_id = ‘27’ ORDER BY `entry_date` desc
Filename: models/search_model.php
Line Number: 486
diff --git a/search_model.php.orig b/search_model.php
index d072392..216ac84 100644
--- a/search_model.php
+++ b/search_model.php
@@ -459,20 +459,24 @@ class Search_model extends CI_Model {
if ($key == 'channel_name')
{
$this->db->order_by('FIELD(channel_id, '.$channel_name_order.')', NULL, FALSE);
+ $this->db->select('channel_id');
}
elseif ($key == 'screen_name')
{
$this->db->order_by('FIELD(author_id, '.$screen_name_order.')', NULL, FALSE);
+ $this->db->select('author_id');
}
else
{
$this->db->order_by($key, $val);
+ $this->db->select($key);
}
}
}
else
{
$this->db->order_by('entry_date', 'desc');
+ $this->db->select('entry_date');
}
//$this->db->limit($data['perpage'], $data['rownum']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment