SQLSTATE[HY093] : pdo statement during insert into mysql db

后端 未结 2 1031
春和景丽
春和景丽 2020-12-21 06:27

Here it is my php code to realize insert into db:



        
2条回答
  •  情话喂你
    2020-12-21 07:11

    Not sure if this is the cause of your error, but in your insert statement, CASE is a MySQL reserved word and should be escaped with backticks.

    $STH = $DBH->prepare("INSERT INTO users (name, 
                                            surname, 
                                            address, 
                                            birth_place,
                                            province,
                                            dt,
                                            sex,
                                            `case`) value (:name
                                                        :surname,
                                                        :address,
                                                        :birth_place,
                                                        :province,
                                                        :dt,
                                                        :sex,
                                                        :case)");
    

提交回复
热议问题