0

I have created a module which includes a custom form. When the form is submitted the module uses drupal_write_record to insert the form contents into the database. The first drupal_write_record is to the node table. Using phpmyadmin I've looked into the node table and I can see there is a record where nid is 11. If I request example.com/?q=node/11 I get a 'page not found' error.

Here is record 11 from the node table:

nid,vid,type,language,title,uid,status,created,changed,comment,promote,sticky,tnid,translate
11,NULL,game,und,Title,1,1,1365111019,1365111019,1,0,0,0,0

Why doesn't example.com/?q=node/11 return the contents of this record as a page? Do I need to do something else?

1
  • 1
    How did you save this node?using content type or custom also if it is custom did you use node_save
    – Ahmed
    Commented Apr 7, 2013 at 14:40

1 Answer 1

2

You cannot write a node using a single drupal_write_record(). Depending on how your content type is defined you will need to write to several tables. But you don't need to know the precise details because the right way to create a node is to use node_save() as Ahmed mentioned in his comment.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.