Hi Guys,

this query looks a bit overcomplicated , what im trying to do is if an upload field (is left blank) the only thing inserted into mysql is the fields that are filled in e.g

if i upload file 12 and 5 only 1,2 and 5's location is stored in mysql i was thinking of this:

PHP Code:
      $upload_query "UPDATE `users` ";
      
## if h1 ##########################################################################
      
if(empty($headshot1)) {
      
      echo 
'';
      
      } else {
      
      echo 
"SET `headshot_1`='$renamed_photo_1'";
      
      }
      
      if(empty(
$headshot2)) {
      
      echo 
'';
      
      } else {
      
      echo 
",`headshot_2`='$renamed_photo_2',";
      
      }
      
      if(empty(
$headshot3)) {
      
      echo 
'';
      
      } else {
      
      echo 
"`headshot_3`='$renamed_photo_3',";
      
      }
      
      if(empty(
$headshot4)) {
      
      echo 
'';
      
      } else {
      
      echo 
"`headshot_4`='$renamed_photo_4',";
      
      }
      
      if(empty(
$headshot5)) {
      
      echo 
'';
      
      } else {
      
      echo 
"`headshot_5`='$renamed_photo_5',";
      
      }
      
      
$upload_query .= "WHERE `username`='$member'";
      
$upload_result mysql_query($upload_query) or die (mysql_error()); 
does this look ok at all or have i went overboard with th equery?

thanks guys

Graham