cancel
Showing results for 
Search instead for 
Did you mean: 

Curly quotes break MySQL query

SOLVED

Curly quotes break MySQL query

I have encountered the strangest things with collections and addFieldToFilter() function.

The given example is not always the case and sometimes the code had been working for months.

 

I execute the following code:

 

$this->addFieldToFilter('`main_table`.`type_id`', $this->_typeId);

This translates to the following faulty query:

 

 

WHERE ```main_table```.```type_id``` = '5'

 

Which gives an unknown column exception from MySQL.

 

Changing the code to:

$this->addFieldToFilter('main_table.type_id', $this->_typeId);

Fixes the issue. The strange thing is that the first code worked for months and maybe years and now out of blue gives an MySQL exception. Besides in other places in the code it still works (using curly quotes in addFieldToFilter() function).

 

Anyone got a clue? 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Curly quotes break MySQL query

Hi @HKServices

 

Read this http://magento.com/security/patches/supee-6788-technical-details

 

I think you have applied the latest patch.

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

View solution in original post

1 REPLY 1

Re: Curly quotes break MySQL query

Hi @HKServices

 

Read this http://magento.com/security/patches/supee-6788-technical-details

 

I think you have applied the latest patch.

---
Problem Solved Click Accept as Solution!:Magento Community India Forum