I want it do display the $body for sure, but if there is a value for the $face, $hat, ect I want it to show that too. I am using this code to do this:

<?php
require("connect.php");

$constant = $_GET['c'];

$row = mysql_query("SELECT * FROM clothes WHERE user_constant='$constant'");
$row = mysql_fetch_array($row);

$body = imagecreatefrompng('images/avatars/avatar.png');

if (!$row['shirt']) {
$shirt = imagecreatefrompng('images/avatars/blank.png');
}
else {
$shirt = imagecreatefrompng($row['shirt']);
}
if (!$row['pants']) {
$pants = imagecreatefrompng('images/avatars/blank.png');
}
else {
$pants = imagecreatefrompng($row['pants']);
}
if (!$row['hat']) {
$hat = imagecreatefrompng('images/avatars/blank.png');
}
else {
$hat = imagecreatefrompng($row['hat']);
}
if (!$row['face']) {
$face = imagecreatefrompng('images/avatars/blank.png');
}
else {
$face = imagecreatefrompng($row['face']);
}
if (!$row['accessory']) {
$accessory = imagecreatefrompng('images/avatars/blank.png');
}
else {
$accessory = imagecreatefrompng($row['accessory']);
}
if (!$row['background']) {
$background = imagecreatefrompng('images/avatars/blank.png');
}
else {
$background = imagecreatefrompng($row['background']);
}

header("Content-type: image/png");
imagepng($body);
imagecreatefrompng($hat, 128, 255, 0);
imagecreatefrompng($face, 128, 255, 0);
imagecreatefrompng($body, 128, 255, 0);
imagecreatefrompng($shirt, 128, 255, 0);
imagecreatefrompng($pants, 128, 255, 0);
imagecreatefrompng($accessory, 128, 255, 0);
imagecreatefrompng($background, 128, 255, 0);
imagedestroy($body);
?>

What is wrong with this is all it is doing is displaying the $body, and nothing else even if it has a value. However, when I try this:

<?php
require("connect.php");

$constant = $_GET['c'];

$row = mysql_query("SELECT * FROM clothes WHERE user_constant='$constant'");
$row = mysql_fetch_array($row);

$body = imagecreatefrompng('images/avatars/avatar.png');

if (!$row['shirt']) {
$shirt = imagecreatefrompng('images/avatars/blank.png');
}
else {
$shirt = imagecreatefrompng($row['shirt']);
}
if (!$row['pants']) {
$pants = imagecreatefrompng('images/avatars/blank.png');
}
else {
$pants = imagecreatefrompng($row['pants']);
}
if (!$row['hat']) {
$hat = imagecreatefrompng('images/avatars/blank.png');
}
else {
$hat = imagecreatefrompng($row['hat']);
}
if (!$row['face']) {
$face = imagecreatefrompng('images/avatars/blank.png');
}
else {
$face = imagecreatefrompng($row['face']);
}
if (!$row['accessory']) {
$accessory = imagecreatefrompng('images/avatars/blank.png');
}
else {
$accessory = imagecreatefrompng($row['accessory']);
}
if (!$row['background']) {
$background = imagecreatefrompng('images/avatars/blank.png');
}
else {
$background = imagecreatefrompng($row['background']);
}

header("Content-type: image/png");
imagepng($face);
imagecreatefrompng($hat, 128, 255, 0);
imagecreatefrompng($face, 128, 255, 0);
imagecreatefrompng($body, 128, 255, 0);
imagecreatefrompng($shirt, 128, 255, 0);
imagecreatefrompng($pants, 128, 255, 0);
imagecreatefrompng($accessory, 128, 255, 0);
imagecreatefrompng($background, 128, 255, 0);
imagedestroy($body);
?>

it displays the face only without the body. How can I fix this to where it shows the body and the $face?