title: how to insert data in mysql( wamp) database through php?
body: <p>I have tried many times, connection is successful, but I can not insert the data please help me.</p>
  
  <p>Following is my code, I have just added an if check, to see if the query does't adds any data to the database then it should give some kind of indication so its saying unable to post. When I see in database table from wamp database, no data is inserted or added to the table, please help me it will be much appreciated. thanks. </p>
  
  <pre><code>    &lt;?php
      if(isset($_POST['id']) &amp;&amp; isset($_POST['name']) &amp;&amp; isset($_POST['semester']) &amp;&amp; isset($_POST['section'])):
      $post_id = $_POST['id'];
      $post_name = $_POST['name'];
      $post_semester = $_POST['semester'];
      $post_section = $_POST['section'];
  
      $link = new mysqli('localhost','root','','registration');
  
      if($link-&gt;connect_error)
          die('connection error: '.$link-&gt;connect_error);
  
      $sql = "INSERT INTO student_info(student_id, student_name, semester, section) VALUES('".$post_id."', '".$post_name."', '".$post_semester."', '".$post_section."',)";
  
      //echo $sql;    
  
      $result = $link-&gt;query($sql); 
  
      if($result &gt; 0):
          echo 'Successfully posted';
      else:
          echo 'Unable to post';
      endif;
  
      $link-&gt;close();
      die();
      endif; 
      ?&gt;
      &lt;!DOCTYPE html&gt;
      &lt;html&gt;
       &lt;head&gt;
       &lt;/head&gt;
       &lt;body&gt;
        &lt;h1&gt;Student Registration&lt;/h1&gt;
        &lt;form action="add.php" method="post"&gt;
          Student ID : &lt;input type="text" name="id"/&gt;&lt;br&gt;&lt;br&gt;
          Student Name : &lt;input type="text" name="name"/&gt;&lt;br&gt;&lt;br&gt;
          Semester : &lt;input type="text" name="semester"/&gt;&lt;br&gt;&lt;br&gt;
          Section : &lt;input type="text" name="section"/&gt;&lt;br&gt;&lt;br&gt;
  
          &lt;input type="submit" value="create"/&gt;
        &lt;/form&gt;
       &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>