title: mysql_query(INSERT ...) function not working in my code
body: <p>I've create database, which basically accept name and Id and answer string of 
  length 47,and my php code will grade the incoming results against the answer key I provided and number containing the count of correct answers will stored in database. this is information of my database.
  database name is marking
  and table called 'answer', which has 5 fields as follow</p>
  
  <pre><code>1) answer_id :int , not null, auto increament.
  2) name: text
  3)id : text
  4)answers : text
  5)correct : int
  </code></pre>
  
  <p>my question and problem is the function is working</p>
  
  <pre><code>// setup query
  $q = mysql_query("INSERT INTO `answer` VALUES 
   (NULL,'$name', '$id','$answers','$correct')");
  // run query
  $result = mysql_query($q);
  </code></pre>
  
  <p>or in another way , nothing storing in my database ???</p>
  
  <p>Thanks in advance.</p>
  
  <p>this is the whole program.</p>
  
  <pre><code>&lt;?php
  error_reporting(E_ALL ^ E_STRICT);
  // to turn error reporting off 
  error_reporting(0);
  
  $name  =$_POST['name']; 
  $id = $_POST['id']; 
  $answers = $_POST['answers'];
  
  // check the length of string
  if(strlen($answers) !=10) 
  {
  print'your answer string must be 10';
  
  return;
  
  } 
  mysql_connect("localhost","root",""); 
  mysql_select_db("marking"); 
  $name = addslashes($name); 
  $id = addslashes($id); 
  $answers =  addslashes($answers); 
  $answer_key =  "abcfdbbjca"; 
  $correct =  0; 
  for($i=0;$i&lt;strlen($answer_key);$i++) 
  {
  
  if($answer_key[$i]  == $answers[$i])
  
  $correct++;
  
  } 
   //  Setup query
  $q = mysql_query("INSERT INTO `answer` VALUES ('$name', '$id','$answers','$correct')");
  $result = mysql_query($q);
  print 'Thnak you. You got' + $correct + 'of 10 answers correct'; 
  ?&gt;
  </code></pre>