Skip to main content

Script

Script

<!--?php 

/*
$select=db_query("SELECT u.name,u.uid FROM `users` u inner join users_roles r on r.uid=u.uid WHERE r.rid=4 ");
while ($result=db_fetch_array($select)){
 $name=ucwords($result['name']);
 $uid=$result['uid'];

$update ="update users  set name ='".$name."' WHERE uid=".$uid;
$res=db_query($update);

}

*/

/*
$filename="sites/default/files/Export_article.csv";

$fp = fopen($filename, "w");

$res = mysql_query("
SELECT node.nid AS Id,
   node.title AS Article,
   node.title AS Keywords,
   node_data_field_issue_nid.field_deck_value AS Subtitle,
    u.name as first_name,
   u.name as middle_name ,
   u.name as last_name ,
    concat ('Volume ',node_node_data_field_issue_nid_node_data_field_year.field_volumenumber_value) as Volume,Concat('Issue ',node_node_data_field_issue_nid_node_data_field_year.field_issuenumber_value ) as Issues ,
   node_node_data_field_issue_nid_node_data_field_year.field_year_value AS Year_of_Issue,
   node_node_data_field_issue_nid.title AS Issue,
   concat('http://www.americanheritage.com/' ,al.dst) as Webaddress
 FROM node node 
 LEFT JOIN content_type_article node_data_field_issue_nid ON node.vid = node_data_field_issue_nid.vid
 LEFT JOIN node node_node_data_field_issue_nid ON node_data_field_issue_nid.field_issue_nid_nid = node_node_data_field_issue_nid.nid
 LEFT JOIN content_type_issue node_node_data_field_issue_nid_node_data_field_year ON node_node_data_field_issue_nid.vid = node_node_data_field_issue_nid_node_data_field_year.vid
 LEFT JOIN content_field_art_contributor node_data_field_art_contributor ON node.vid = node_data_field_art_contributor.vid inner join users u on u.uid=node_data_field_art_contributor.field_art_contributor_uid inner join users_roles r on r.uid=u.uid  inner join  url_alias al ON al.src = CONCAT('node/',node.nid)
 WHERE node.type in ('article') and r.rid=4  order by Article ASC");

// fetch a row and write the column names out to the file
$row = mysql_fetch_assoc($res);
$line = "";
$comma = "";
foreach($row as $name =-->
<p>$value) { $line .= $comma . '"' . str_replace('"', '""', $name) . '"'; $comma = ","; } $line .= "\n"; //fputs($fp, $line); // remove the result pointer back to the start mysql_data_seek($res, 0); // and loop through the actual data while($row = mysql_fetch_assoc($res)) { $nid=$row['Id']; $row['Keywords']=''; $query_key=mysql_query("select DISTINCT(td.name) from node n inner join term_node tn ON n.nid = tn.nid LEFT JOIN term_data td ON tn.tid = td.tid where n.nid=$nid and td.vid =7"); while($rows = mysql_fetch_assoc($query_key)) { $row['Keywords'] .= $rows['name'].", "; } $row['Keywords'] = rtrim($row['Keywords'],", "); $concatt= $row['Volume'].", ".$row['Issues']; $row['Volume']=$concatt; $row['Subtitle']= strip_tags($row['Subtitle']); $author =$row['first_name']; $row_author=explode(" ",$author); $row['first_name']=ucwords($row_author[0]); if (empty($row_author[2])){ $row['middle_name']=''; $row['last_name']=ucwords($row_author[1]); } else { $row['middle_name']=ucwords($row_author[1]); $row['last_name']=ucwords($row_author[2]); } //echo "</p>

<pre>
";
// print_r($row);
//echo "</pre>

<p>"; $line = ""; $comma = ""; foreach($row as $value) { $line .= $comma . '"' . str_replace('"', '""', $value) . '"'; $comma = ","; } $line .= "\n"; // fputs($fp, $line); } fclose($fp); */ ?&gt;</p>
 

We hope you enjoy our work.

Please support this 72-year tradition of trusted historical writing and the volunteers that sustain it with a donation to American Heritage.

Donate

Featured Articles

Famous writers including Emerson, Thoreau, Hawthorne, and the Alcotts turned Sleepy Hollow Cemetery into our country’s first conservation project.

Native American peoples and the lands they possessed loomed large for Washington, from his first trips westward as a surveyor to his years as President.

In his Second Inaugural Address, Abraham Lincoln embodied leading in a time of polarization, political disagreement, and differing understandings of reality.

A hundred years ago, America was rocked by riots, repression, and racial violence.

During Pres. Washington’s first term, an epidemic killed one tenth of all the inhabitants of Philadelphia, then the capital of the young United States.

Now a popular state park, the unassuming geological feature along the Illinois River has served as the site of centuries of human habitation and discovery.  

The recent discovery of the hull of the battleship Nevada recalls her dramatic action at Pearl Harbor and ultimate revenge on D-Day as the first ship to fire on the Nazis.

Our research reveals that 19 artworks in the U.S. Capitol honor men who were Confederate officers or officials. What many of them said, and did, is truly despicable.

Here is probably the most wide-ranging look at Presidential misbehavior ever published in a magazine.

When Germany unleashed its blitzkreig in 1939, the U.S. Army was only the 17th largest in the world. FDR and Marshall had to build a fighting force able to take on the Nazis, against the wishes of many in Congress.

Roast pig, boiled rockfish, and apple pie were among the dishes George and Martha enjoyed during the holiday in 1797. Here are some actual recipes.

Born during Jim Crow, Belle da Costa Greene perfected the art of "passing" while working for one of the most powerful men in America.