图像上载到服务器,但表中没有创建任何字段

We have it setup to where a user can check a box to signal that the content is mature content. Photos that are uploaded that are not checked are uploaded AND stored in the database, however if they check the box to mark it as adult, it still uploads to the server, but no field is created in the table.

$mature=$HTTP_POST_VARS["mature"];
if($mature=="on") {
// $adult=1; // has no function, could be useful?
}
else {
// $adult=0; // has no function, could be useful?

// ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE 

      $sql="select photo_id as a from user_pics where user_id = $_SESSION[user_id]"; 
      $result2 = mysql_query($sql); 
      $pic=mysql_num_rows($result2); 

      if($pic==0) {
// if no photos found within the database table user_pics

                     // Identify if adult or not.
                     $mature_content=$HTTP_POST_VARS["mature"];
                     if($mature_content=="on") {
                     $adult_rated=1;
                     }
                     else {
                     $adult_rated=0;
                     }
                     // Identify if adult or not.

                    $sql="insert into user_pics";
                    $sql.="(user_id";
                    $sql.=", caption";
                    $sql.=", mature";
                    $sql.=", photo_url";
                    $sql.=", medium_photos";
                    $sql.=", small_photos)";
                    $sql.=" values($_SESSION[user_id]";
                    $sql.=", '$caption'";
                    $sql.=", $adult_rated";     
                    $sql.=", '$picture_url'";       
                    $sql.=", '$med_picture_url'";       
                    $sql.=", '$small_picture_url')";
                    $result=mysql_query($sql);      
                    $photo_id = mysql_insert_id();

      } else {
// if one or more than one photo

                // Identify if adult or not.
                $mature_content=$HTTP_POST_VARS["mature"];
                if($mature_content=="on") {
                $adult_rated=1;
                }
                else {
                $adult_rated=0;
                }
                // Identify if adult or not.

                $sql="insert into user_pics";
                $sql.="(user_id";
                $sql.=", caption";
                $sql.=", mature";
                $sql.=", photo_url";
                $sql.=", medium_photos";
                $sql.=", small_photos)";
                $sql.=" values($_SESSION[user_id]";
                $sql.=", '$caption'";
                $sql.=", $adult_rated";     
                $sql.=", '$picture_url'";       
                $sql.=", '$med_picture_url'";       
                $sql.=", '$small_picture_url')";
                $result=mysql_query($sql);      
                $photo_id = mysql_insert_id();
      } 
// ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE ALBUM CODE HERE 
}

If $mature=="on" then you are skipping the entire block of code that might insert something into the database. So nothing will get inserted if that is true. Unless I am misunderstanding what you are asking.