Instrução PHP If / Else não funciona em While loop
Eu tenho trabalhado nesse código por cerca de uma hora e não consigo entender por que ele não está funcionando. O PHP permite instruções If / Else dentro de While loops? Eu tentei adicionar echos diferentes para ambas as instruções If / Else e o último (Else) não será mostrado. Isso é porque estou tentando usar os mesmos nomes de variáveis?
while($row = mysql_fetch_array($result))
{
//assign variables
$title = $row['title'];
$file_url = $row['file_location'];
$category = $row['category'];
$layout = $row['layout'];
If ($layout = "vertical")
{
//Page Layout
$BODYLAYOUT = "vertical_body";
$GAMECONTAIN = "vertical_gameContain";
$GAMEWIDTH = "vertical_game";
}
Else
{
// Page Layout
$BODYLAYOUT = "horizontal_body";
$GAMECONTAIN = "horizontal_gameContain";
$GAMEWIDTH = "horizontal_game";
}