Fix collation mismatch error in productos search
Added COLLATE latin1_swedish_ci to LIKE operations in Search() function to prevent 'Illegal mix of collations' error when searching by modelo or codigoBarra. The database uses latin1_swedish_ci but PHP 8 uses UTF-8 encoding.
This commit is contained in:
@@ -686,10 +686,10 @@ class Producto extends Main
|
||||
$sqlAdd .= ' AND p.prodCatId = "'.$this->prodCatId.'"';
|
||||
|
||||
if($this->descripcion)
|
||||
$sqlAdd .= ' AND p.modelo LIKE "%'.$this->descripcion.'%"';
|
||||
$sqlAdd .= ' AND p.modelo LIKE "%'.$this->descripcion.'%" COLLATE latin1_swedish_ci';
|
||||
|
||||
if($this->codigoBarra)
|
||||
$sqlAdd .= ' AND p.codigoBarra LIKE "%'.$this->codigoBarra.'%"';
|
||||
$sqlAdd .= ' AND p.codigoBarra LIKE "%'.$this->codigoBarra.'%" COLLATE latin1_swedish_ci';
|
||||
|
||||
if($sqlAdd != ''){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user