SQLite テーブルにレコードを挿入するコードがいくつかあります。
$statement = $db -> prepare("INSERT INTO posts (postedOn, content, tags) VALUES (DATE('now'), :content, :tags)");
$statement -> bindParam(':content', $content);
$statement -> bindParam(':tags', $tags);
問題は、postedOn 列が日付のみを取得し、投稿の時刻を取得しないことです。代わりに NOW() を使用してみました:
$statement = $db -> prepare("INSERT INTO posts (postedOn, content, tags) VALUES (NOW(), :content, :tags)");
しかし、私は得る
Call to a member function bindParam() on a non-object
最初の bindParam 呼び出しで。これを SQLite 2009 Pro で実行すると問題なく動作します。
INSERT INTO posts (postedOn, content, tags) VALUES (NOW(), 'some content', 'tags')
NOW() のように準備しないのはなぜですか?