title: MySQL query shows die error in PHP
body: <p>The following is my test.php page which gets redirected from registration.php page.
  everything over here works very fine except sql query. All the alert tags show session variable values perfectly well, but this page gives 'Error, insert query failed' error.
  Tried all possibilities like quotes to variables in query, etc., But nothing is working.. Please someone help..</p>
  
  <pre><code>&lt;?php
  include "connect.php";
  session_start();
  
  $ser= $_SESSION['service'];
  $comp=$_SESSION['comp'];
  $yr= $_SESSION['year'];
  $addr= $_SESSION['addr'];
  $per= $_SESSION['per'];
  $no= $_SESSION['no'];
  $email= $_SESSION['email'];
  $uname= $_SESSION['uname']; 
    echo "&lt;script&gt;alert('$ser')&lt;/script&gt;";
    echo "&lt;script&gt;alert('$comp')&lt;/script&gt;";
    echo "&lt;script&gt;alert('$yr')&lt;/script&gt;";
    echo "&lt;script&gt;alert('$no')&lt;/script&gt;";
    echo "&lt;script&gt;alert('$addr')&lt;/script&gt;";
  if($ser=='designing'){
     $ser=1;
  }else if($ser=='webdev'){
     $ser=2;
  }else{
     $ser=3;
  }
  echo "&lt;script&gt;alert('$ser')&lt;/script&gt;";
  $sql= "insert into login values 
        ('$uname','xxxx',$ser,'$comp',$yr,'$addr','$per',$no,'$email')";
  mysql_query($sql) or die('Error, insert query failed');
  ?&gt;
  
  &lt;span style="font-family:Tahoma; font-weight:bold; font-size:11px;color:#666666" 
        align=center&gt;Your Registration is successful...&lt;br/&gt;Our team will contact you at
        the earliest...
  &lt;/span&gt;
  </code></pre>