Is there any way to assign a value, which is acquired from select clause, to a variable so that I can use that variable in other query?
For example, I want to give gold, silver, and bronze medal to first, second, and third place holder respectively.
I have a table(mytable) with records (second), and I will get the name of the top three by
select name from mytable order by second desc limit 3;
and somehow I would like to assign $goldwinner=name1, $silverwinner=name2, $bronzewinner=name3
so that I can use it for
update medaltable set gold = gold + 1 where name = $goldwinner
and same for silver and bronze..
Is there any way I can do this??