I want to update the table.I have two update query but I want to use it in a single update query.Column name and Where condition are different in both queries.Would you help me in this?
$sql="UPDATE points SET hero='$total_hero'+'$points' WHERE user_id='$hero_id'";
$sql="UPDATE points SET zero='$total_zero'+'$points' WHERE user_id='$zero_id'";
You can make use of the below query
$sql="UPDATE points
SET hero= CASE WHEN user_id='$hero_id' THEN '$total_hero'+'$points' ELSE hero END,
zero= CASE WHEN user_id='$zero_id' THEN '$total_zero'+'$points' ELSE zero END
WHERE user_id='$hero_id' OR user_id='$zero_id'";
Hope this would help you out.