I have a table
id / product_id / var / active / price
the var column contains three variables separated by :
e.g. (37:48:80)
i want to change the price column to a set value if var contains the right options.
i.e.
33:38:57 through to 80 would = 450
33:39:57 through to 80 would = 0
33:40:57 through to 80 would = 0
33:41:57 through to 80 would = 450
i would like to pass the first variable an array of the second variable and if matched update price
my very bad sql would look like:
UPDATE 'price' = 450
WHERE 'var' = 33:array(38,41 etc):array(57,58 etc)
i know thats really wrong but thought may help you understand what I’m trying to do.
I don’t quite get the
through to 80but I get the idea of your query (I guess…). I kinda hate regular expressions but they seem to be the right tool to solve this. Give this a try: