Fix collation error by using BINARY in LIKE operations
Added BINARY keyword to LIKE clauses in Search() function to bypass collation issues. BINARY forces byte-by-byte comparison and avoids 'Illegal mix of collations' error when connection uses utf8mb4 and table uses latin1_swedish_ci.
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 BINARY "%'.$this->descripcion.'%"';
|
||||
|
||||
if($this->codigoBarra)
|
||||
$sqlAdd .= ' AND p.codigoBarra LIKE "%'.$this->codigoBarra.'%"';
|
||||
$sqlAdd .= ' AND p.codigoBarra LIKE BINARY "%'.$this->codigoBarra.'%"';
|
||||
|
||||
if($sqlAdd != ''){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user