以下のコードを書いたのですが
PDOを使用したINSERTが出来ません。
なぜでしょうか。
エラーも出ず、PDOのエラーコードもnullでした。
//以下DB追加処理 try { //PDOオブシェクト生成 $pdo = new PDO($conf['db'],$conf['user'],$conf['pass']); //INSERTクエリ作成 $query = $pdo->prepare('INSERT INTO recess (user_id,recess_month,mail_id,name,s_name,name_kana,s_name_kana,birth,reason,address) VALUES (:user_id,:recess_month,:mail_id,:name,:s_name,:name_kana,:s_name_kana,:birth,:reason,:address:)'); $query->bindValue(':user_id', $post['club_code'], PDO::PARAM_INT); $query->bindValue(':recess_month', $recess_month, PDO::PARAM_STR); $query->bindValue(':mail_id', $mailid, PDO::PARAM_INT); $query->bindValue(':name', $post['name'], PDO::PARAM_STR); $query->bindValue(':s_name', $post['s_name'], PDO::PARAM_STR); $query->bindValue(':name_kana', $post['name_kana'], PDO::PARAM_STR); $query->bindValue(':s_name_kana', $post['s_name_kana'], PDO::PARAM_STR); $query->bindValue(':birth', $post['birth'], PDO::PARAM_STR); $query->bindValue(':reason', $post['reason'], PDO::PARAM_STR); $query->bindValue(':address', $post['address'], PDO::PARAM_STR); $query->execute(); } catch(PDOException $e) { exit('データベース接続失敗。'.$e->getMessage()); return false; }
回答4件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。