title: A record is saving as two or more in the database in PHP
body: <p>A record is saving as two or more in the database. I couldn't find where the problem was.</p>
  
  <pre><code>if(isset($_POST['send_photo'])){
    if ($_FILES["gallery_photo"]["type"]=="image/jpeg") {
        $photo_name=$_FILES["gallery_photo"]["name"];
        $photo= explode(".", $photo_name);
        $extension=$photo[1];
        $new=md5($photo[0]);
        $newname="uploads/gallery/".$new.".".$extension;
   }
    if (move_uploaded_file($_FILES["gallery_photo"]["tmp_name"],$newname)) {
           $query = $db-&gt;query("INSERT INTO gallery (student_id, first_name, last_name, photo) VALUES ( '$student_id', '$first_name', '$last_name', '$newname') ",PDO::FETCH_ASSOC);
           $query-&gt;execute(array($newname));
       }
  }
  </code></pre>
  
  <pre><code> &lt;form class="form"  method="post" action="" enctype="multipart/form-data"&gt;
                      &lt;div class="text-center"&gt;
                          &lt;h6&gt;Photo...&lt;/h6&gt;
                          &lt;input type="file" name="gallery_photo" class="text-center center-block file-upload"&gt;
                          &lt;button class="btn btn-lg btn-success " type="submit"  name="send_photo"&gt;&lt;i class="glyphicon glyphicon-ok-sign"&gt;&lt;/i&gt; Gönder&lt;/button&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
  </code></pre>