データの更新ファンクション:drupal_write_recode() を使用してデータ挿入を行います
// テーブルの定義
テーブル名: custom_table
フィールド名: id, title, desc
主キー:id (auto-increment)
// drupal_write_record() の使用
$data=array(
'title' => 'title-aaaaaa',
'desc' => 'desc-aaaaaa',
);
drupal_write_recode( 'custom_table', $data ) ;
- これを実行するとエラーが発生
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc) VALUES ('title-aaaaaa', 'desc-aaaaaa')' at line 1:
INSERT INTO {custom_table} (title, desc) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => title-aaaaaa [:db_insert_placeholder_1] => desc-aaaaaa )
drupal_write_record() (C:\develop\sources\php\2drills-d7\includes\common.inc ファイル 7383行).