How to echo PHP variable above the code
===

I want to echo an variable $download at the top of my page . But the variable works only after the code , ie. echoing after the below code .The below link generates an unique id image from database. i would like to display that image url at the top.Thanks for help,

	 
works
    
    <?php $download = " http://www.domain.com/$rowimg[idimage]"; ?>

    <?echo $download ?>


not works 

    <?echo $download ?>
    <?php $download = " http://www.domain.com/$rowimg[idimage]"; ?>


