There is a lot of problems with your code but I will try to focus on just getting the photos name out of the database.
First I think your MySQL query is part to blame.
mysql_query("Select value from site_setup where name='PHOTO_RIGHT'")
Let put that query into plain english.
SELECT the value of the "value" column FROM the "site_setup" table WHERE the "name" column equals "PHOTO_RIGHT:"
Note that it is not retrieving the value of the "name" column. So I hope the name of the photo is in the value column. If so hopefully only one row in your table has "PHOTO_RIGHT" as the value of the "name" column, otherwise you may not be able to get the photo you want consistently, without adding a bit more code.
Next the value of any column does not become a php variable. PHOTO_RIGHT can not become $PHOTO_RIGHT without you directly setting the php variable $PHOTO_RIGHT to PHOTO_RIGHT. But as noted above you didn't retrieve the value of the name column so with your current code you can't even set $PHOTO_RIGHT to PHOTO_RIGHT. However you can set $PHOTO_RIGHT to equal the value of the "value" column.
$PHOTO_RIGHT = $row['value'];
Note that all values you retrieved in your query are stored in the $row array.
Basically all the above was written to point out that you do not have the $PHOTO_RIGHT variable defined anywhere. Hopefully everything above will help you figure out how to get it defined so you can see your image.
I would ask if you have your error reporting set to report all php errors. If not turn it on, at least while you are in the development process, it will help you find some of these errors.