php - Mysql how to combine 2 update queries in 1 -


update `items` set `score`=[value-1],`up_votes`=[value-2],`down_votes`=[value-3] `id` = $id update `items` set `score`=[value-1],`up_votes`=[value-2],`down_votes`=[value-3] `id` = $id 

how can combine these 2 queries when ids needs dynamic? both coming table items.

edit, score ( can + 10 or - 10) upvotes ( can +1 or -1) , downvotes ( can +1 or -1)

so kind of dynamic, sorry misunderstanding

try this, $idlist comma separated list,

update `items` set `score`=[value-1],`up_votes`=[value-2],`down_votes`=[value-3] `id` in ($idlist) 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -