Page: http://api.drupal.org/api/group/database/7
Original text

INSERT INTO node (nid, title, body) VALUES (1, 'my title', 'my body')

one would instead write:

$fields = array('nid' => 1, 'title' => 'my title', 'body' => 'my body');
db_insert('my_table')->fields($fields)->execute();

Last line doesn't seems good. I think this is a typo:

db_insert('node')->fields($fields)->execute();
CommentFileSizeAuthor
#1 dbdoc.patch763 bytesmr.baileys

Comments

mr.baileys’s picture

Priority: Normal » Minor
Status: Active » Needs review
StatusFileSize
new763 bytes

Correct, good catch. Patch attached to correct the api docs.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. I concur with the logic of the reporter and patcher, and it's a good patch.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.