title: How to store file path in database using php?
body: <p>I have two php pages adp3.php(form page) and adp4.php(uploads content to database)</p>
  
  <p>adp3.php:</p>
  
  <pre><code>&lt;form method="POST" enctype="multipart/form-data"&gt;
   &lt;label&gt;SUBJECT:&lt;/label&gt;&lt;select name="subject"&gt;
   &lt;?php 
  $query="SELECT * FROM subject WHERE SyllabusID=".$batch1." and SemID=".$sems."";
  $result=mysqli_query($con, $query);
  //loop
  foreach($result as $subject){
  ?&gt;
  &lt;option value="&lt;?php echo $subject['SubjectID']."-".$subject['SubjectName']; ?&gt;"&gt;&lt;?php echo $subject['SubjectName']; ?&gt;&lt;/option&gt;
  &lt;?php
  }
  ?&gt;
    &lt;/select&gt;
     &lt;br&gt;
  DATE: &lt;select name="date"&gt;
      &lt;option&gt;MAY/JUNE&lt;/option&gt;
      &lt;option&gt;NOV/DEC&lt;/option&gt;
      &lt;/select&gt;
  
      &lt;p color="white"&gt;YEAR: &lt;input  type="varchar" name="year"/&gt;&lt;/p&gt;&lt;/br&gt;
  
      &lt;p color="white"&gt;PAPER LINK: &lt;input  type="file" name="file"/&gt;&lt;/p&gt;&lt;/br&gt;
           &lt;br&gt;
           &lt;button formaction="adp4.php" class="btn-login"&gt;GO&lt;/button&gt;
  </code></pre>
  
  <p> </p>
  
  <p>adp4:</p>
  
  <pre><code>&lt;?php
  $date =$_POST['date'];
  $year=$_POST['year'];
  $file=$_FILES['file'];
  
      if($date &amp;&amp; $year)
      { mysql_connect("localhost","root","") or die("we couldnt connect");
         mysql_select_db("dbmsproj");
          $result=mysql_query("INSERT INTO paper(SubjectID,Date,Dlink) values('$subid','$date $year','$file')");
  
        ?&gt;  &lt;p color="white"&gt;&lt;?php echo "Paper SUCCESSFULLY ADDED TO THE DATABASE";
      }
      else
      {?&gt;
          &lt;p color="white"&gt;&lt;?php echo  "ALL FIELDS NEED TO BE FILLED ";
      }
          ?&gt;
  </code></pre>
  
  <p>everything is getting entered correctly in db besides file path(shows "Array" in file path field).. please help</p>
  
  <p>Update: (PROBLEM SOLVED) Thank you guys for helping me. My code is finally working . you guys are the <strong>best</strong></p>