There is a code, it is generally working, it has been used more than once, everything was fine

$data = array( 'data' => "$date", 'name' => "$name", 'phone' => "$phone", 'mail' => "$mail", 'tovar' => "$tovar"); $STH = $DBH->prepare("INSERT INTO orders (data) values (:date)"); $STH->execute($data); echo "data=".$date." name= ".$name." phone= ".$phone." mail= ".$mail." tovar=".$tovar; 

At the end, echo outputs everything, does not generate errors, but does not write, but if you replace $STH with

 $STH = $DBH->prepare("INSERT INTO orders ( data,name,phone,mail,tovar ) values ( '$date','$name','$phone','$mail','$tovar' )"); 

Everything is working

  • Read about bindParam and execParams well and the rules for setting them, to paint them for a long time, the manual is clearer. But in short, you didn’t set the parameters for the substitution - Andrei Shpileva
  • one
    Есть код,он вообще рабочий,не раз применял его ...... но не записывает - you would decide - it is working and there is no problem or not, then it cannot be working, in principle, and you could not do it more than once apply))) - Alexey Shimansky
  • I used it on another page, only other variables and another request, everything works there, an example is taken from here habrahabr.ru/post/137664 - zkolya
  • Show the structure of the table? Particularly interested in keys and restrictions like NOT NULL - Dmitriy Simushev
  • Removed quotes from variables, everything worked - zkolya

0