sql中的整数列接受字符作为值

I have an auto increment field of int(11),while inserting run time values it accepting characters and runs the query successfully but it was not inserted in table.What i should i do?

 $res=mysqli_connect($target_address,$target_id,$target_password,$db_name);

 if($res)
 {
     $conn2 = new PDO("mysql:host=$target_address;dbname=$db_name", $username, $target_password);
     $q2="INSERT INTO $name ($value_2) VALUES ($value21)";
      echo $q2;
   $q3=$conn2->query($q2);
   $sth = $conn2->prepare($q2);
   $sth->execute();
   $arr = $sth->errorInfo();
   $arr1=$arr[2];
   if($q3)
   {

      echo "<script type='text/javascript'>alert('Inserted successfully...');</script>";
   }
      else
   {
     echo '<script type="text/javascript">alert("' .$arr1. '")</script>';
   }
 }
   else
   {
  echo "Connection failed";  
   }

please help me.