I have 2 update queries that I want to combine into one query. Is there a way to do this?
Query 1:
update user_meta set
meta_value = case meta_key
when 'mobile' then '{$mobile}'
when 'interest' then '{$interest}'
when 'occupation' then '$occupation'
when 'address' then '{$address}'
when 'city' then '{$city}'
when 'country' then '{$country}'
when 'about' then '{$about}'
when 'website' then '{$website}'
else meta_value
end
where userid = {$id}
The other query:
update user set fullname='{$fullname}' where userid={$id}
Both of those queries are performed at the same time in same function, but have different tables. Also, this way I have to run two update queries.
And what if I want to put this when statements into a loop? If there are 100 values to update, it would be very hard.