Magento problems: General error: 1005
November 26, 2010fix for an iframe injection attack
January 25, 2011let’s assume you have a mysql field which is composed from comma separated values
table name: products
field name from table products: category_ids (the comma separated list of categories)
let’s assume that we want to search all products for a certain category. the first idea will be to use the IN mysql function: (I will note {$var} as an external variable)
SELECT * FROM products WHERE {$category_id} IN category_ids
however it won’t work so this statement should be used:
SELECT * FROM products WHERE category_ids REGEXP ‘^{$category_id},|,{$category_id},|,{$category_id}$|^{$category_id}$’