I want to add company details in a node from an external database. How to add more fields for the data in my table?
There are ID|post_title|post_content|Adress and many more. I set the database connection and be able to add one data in the body
$node->body(LANGUAGE_NONE)(0)(‘value’) = $row->post_title;
// Set the external database as the active one.
db_set_active('db_wirdfit');
// Retrieve data from the external database.
$result = db_query('SELECT * FROM wirdfit.wirdfit_data');
// Set the active database to the default one.
db_set_active();
foreach ($result as $row) {
$node->type = "page";
$node->title = $row->id;
// node_object_prepare($node); // Set some default values.
$node->body(LANGUAGE_NONE)(0)('value') = $row->post_title;
$node->body(LANGUAGE_NONE)(0)('summary') = text_summary($row->post_title);
$node->body(LANGUAGE_NONE)(0)('format') = 'full_html';
Whats the best way to add all the data from the db table into the node
Can anybody help?