0

this query just enter numbers and when I put any characters doesn't work . also my columns on DB is all var-char, so i don't have problem on DB schema . and i have this error after :

Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'k' in 'field list' in C:\xampp\htdocs\art-legend\Courses\courses\index.php:166 Stack trace: #0 C:\xampp\htdocs\art-legend\Courses\courses\index.php(166): PDOStatement->execute() #1 {main} thrown in C:\xampp\htdocs\art-legend\Courses\courses\index.php on line 166

  if($_SERVER['REQUEST_METHOD'] == 'POST') {


  echo "<h1 class='text-center'>UpdateMember</h1>" ;
  



  $name= $_POST['name'] ;
  $kind= $_POST['kind'] ;
  $length= $_POST['length'] ;
  $download= $_POST['download'] ;
  $link= $_POST['link'] ;
  $place= $_POST['place'];




  $stmt =$con->prepare("INSERT INTO
  developer
   (name,kind,length,download,link,place)
   VALUES 
   ($name,$kind,$length,$download,$link ,$place)
   "); 

    $stmt->execute();

    

      }

 }
Fuad Ahmad
  • 33
  • 8
  • 2
    Strings **must** be quoted in regular SQL queries. You're halfway to doing this correctly, though. You have the prepare, now all you need is to bind your parameters so you don't ever need to worry about this type of quoting issue ever again. See the duplicate links to see how to bind your parameters. – aynber Oct 04 '21 at 19:36
  • $stmt =$con->prepare("INSERT INTO developer (name,kind,length,download,link,place) VALUES ('$name','$kind','$length','$download','$link' ,'$place');"); you should add single quote --> ' – Maximiliano Bertiaux Oct 04 '21 at 21:09

0 Answers0