1. University of Virginia
  2. Arts & Sciences

Import

<?php
$hostName = "dbm2.itc.virginia.edu";
$userName = "mobile";
$password = "db4iA&B";
$dbName = "mobile_catalog";
mysql_connect($hostName, $userName, $password) or die("Unable to connect to host $hostName");
mysql_select_db($dbName) or die( "Unable to select database $dbName");

$query = "SELECT Number, Title, Career, Units, CourseDescription FROM `Courses` WHERE `Mnemonic` = 'ANTH'";
$result = mysql_query($query);

while($listing=mysql_fetch_array($result)) {
$node = new StdClass();
// Information for base node
$node->type = 'course'; // *** This needs to be a valid content type
node_object_prepare($node);

$node->title = 'ANTH' . ' ' . $listing['Number'];
$node->language = LANGUAGE_NONE;

$node->body[$node->language][0]['value'] = $listing['CourseDescription'];
$node->body[$node->language][0]['summary'] = '';
$node->body[$node->language][0]['format'] = 'filtered_html';

$node->field_course_name[$node->language][0]['value'] = $listing['Title'];
$node->field_career[$node->language][0]['value'] = $listing['Career'];
$node->field_units[$node->language][0]['value'] = $listing['Units'];

$node = node_submit($node);
node_save($node);
}
?>