I am importing data into drupal from an old site. I wrote a script to parse an html page and insert the new nodes. The script runs correctly and I see all of the data in the DB. However, when I view nodes through drupal, some of the fields do not show.
For example, I have custom content type "Publication." A publication has title&body + url and type (both text). When I look at the content_type_publication table in phpMyAdmin, for the first node I see that field_type_value="print" and field_url_value="http://employeebenefitnews.blogspot.com/". But when I go to mysite.com/node/1, I do not see type: print
url:http://employeebenefitnews.blogspot.com/. On the page html, <div class="field field-type-text field-field-url"> is missing entirely.
If my data is in the database, why isn't it showing up on the site? I will paste my code below. Am i missing some inserts?
function insert_publication( $pub_name, $type, $time, $url ) {
global $db_conn;
if( empty( $url ) || is_null( $url ) ) {
$url = '';
}
// create node
mysql_query( "insert into node (type, title, uid, status, created, changed, comment) VALUES ('publication', '".$pub_name."', 1, 1, ".$time.", ".$time.", 2)", $db_conn );
$nid = mysql_insert_id( $db_conn );
mysql_query( "update node set vid=".$nid." where nid=".$nid, $db_conn );
// create revision
mysql_query( "insert into node_revisions (nid, vid, uid, title, timestamp) values (".$nid.", ".$nid.", 1, '".$pub_name."', ".$time.")", $db_conn );
// create comment statistics
mysql_query( "insert into node_comment_statistics (nid, last_comment_timestamp, last_comment_uid) values (".$nid.", ".$time.", 1)", $db_conn );
// add auxillary fields
mysql_query( "insert into content_type_publication (vid, nid, field_type_value, field_url_value) values (".$nid.", ".$nid.", '".$type."', '".$url."')", $db_conn );
// return nid
return $nid;
}
Comments
Full script