Hi,
I have a bit of a problem, well its getting my head around it thats the problem.
I have a select menu, with different options based on the users. They can select option1, 2, 3, 4 etc or ALL. If they select all I want to look up all that users options from a table, then insert it into another table. I also need to be able to see if that option already exists in the table, and if so, update the record. Trouble is, I don't want to have separate statements for insert and update for 'ALL' and the single options. I need to have it in the same sql statements.
i.e. if ($value == ALL){
select values from other_table where user=user_id
$value=mysql_fetch_rom($result)
}
sql=select * from table1 where value=$value[0]
result=(sql)
if (!$result){
insert into table1 values ($value[0], $time)
} else {
update table1 set time=$time where value=$value[0]
}
(i know there are some coding errors in this, but its the basics)
I need to insert/update $value if its just 1 of the selected options, or if its the 'ALL' option.
Can anyone help?