title: Unable to insert into mysql database using php because of the query
body: <p>I have this piece of code where i want to insert some values into a particular database. For some reason the records are not stored into the database. I have an idea that something is wrong with my mysql_query.</p>
  
  <p>Possible problems which you think might cause this problem (I have checked , and they do not affect my problem):
  Connection to the database is not established.
  Variables do not contain values.</p>
  
  <p>Here is the code:</p>
  
  <pre><code> &lt;?php 
  include('includes/connect-db.php'); 
  
  $firstname = mysql_real_escape_string(stripslashes(trim($_POST['firstname'])));
  $surname = mysql_real_escape_string(stripslashes(trim($_POST['surname'])));
  $username = mysql_real_escape_string(stripslashes(trim($_POST['username'])));
  $password = mysql_real_escape_string(stripslashes(trim($_POST['password'])));
  $email = mysql_real_escape_string(stripslashes(trim($_POST['email'])));
  $tel = mysql_real_escape_string(stripslashes(trim($_POST['tel'])));
  $month = mysql_real_escape_string(stripslashes(trim($_POST['month'])));
  $day = mysql_real_escape_string(stripslashes(trim($_POST['day'])));
  $year = mysql_real_escape_string(stripslashes(trim($_POST['year'])));
  $address = mysql_real_escape_string(stripslashes(trim($_POST['address'])));
  $postcode = mysql_real_escape_string(stripslashes(trim($_POST['postcode'])));
  $city = mysql_real_escape_string(stripslashes(trim($_POST['city'])));
  $country = mysql_real_escape_string(stripslashes(trim($_POST['country'])));
  
  if(isset($_POST['submit_register'])) {
  
  
      if(!empty($firstname) &amp;&amp; !empty($surname) &amp;&amp; !empty($username) &amp;&amp; !empty($password) &amp;&amp; !empty($email) &amp;&amp; !empty($tel) &amp;&amp; !empty($month) &amp;&amp; 
      !empty($day) &amp;&amp; !empty($year) &amp;&amp; !empty($address) &amp;&amp; !empty($city) &amp;&amp; !empty($country)) {
  
      mysql_query("INSERT INTO customers (firstname, surname, username, password, email, tel, month, day, year, address, city, country)
      VALUES ('$firstname','$surname','$username','$password', '$email', '$tel', '$month', '$day','$year','$address','$postcode','$city','$country')");
      echo'success';
      }
      else{
      echo'failure';
      }
  
  }
  
  
  ?&gt;
  </code></pre>