I have a little issue that I can't figure out, basically a user fills in a form, this data saves into a table, but i have another table where based on some values will update a value in that table to yes.
So for example in my form i have value1, value2, value3, value4. all of which are drop down menus with values in that save into a field of the same name in table1.
Now in table2 i have a field called spaces, and spacetaken. Each has of these values in this table has corresponds its id to that of value1/2/3/4 fields in tabl1. I hope i explained that ok.
Now basically when i save a value i want it to update spacetaken to yes, so for example value1 could be 44, value2 could be 55 and both were selected in drop down and saved to table1, now i want to update table2 spacetaken to yes where spaces = value1 and value2
I have this so far
UPDATE table2 SET spacetaken='yes' WHERE spaces='value1' AND spaces='value2'
this doesnt work.
but
UPDATE table2 SET spacetaken='yes' WHERE spaces='value1'
will set the space with id same as value1 to taken - yes, basically i want a way to set spacestaken to yes based on multiple values.
Sorry if i didnt explain this very well.
Thanks in advance.
Ian
How can your value be'value1' AND 'value2' at the same time?
Try using OR instead...
Use OR here
UPDATE table2 SET spacetaken='yes' WHERE spaces='value1' OR spaces='value2'
OR
UPDATE table2 SET spacetaken='yes' WHERE spaces IN ('value1','value2')
UPDATE table2 SET spacetaken='yes' WHERE spaces='value1' OR spaces='value2'