This will create a XML file:
PHP Code:
<?php
// $rows is just sample data
// You'll have to gather up your data here:
$rows = array();
$rows[] = array( 'id' => 'N1', 'name' => 'ATP');
$rows[] = array( 'id' => 'N2', 'name' => 'ADP');
$rows[] = array( 'id' => 'N3', 'name' => 'H');
$file= fopen("list_of_species.xml", "w");
$xml = '<?xml version="1.0" encoding="UTF-8" ?>' . "\r\n";
$xml .= "<listOfSpecies>\r\n";
foreach ($rows as $row) {
$xml .= '<species id="' . $row['id'] . '" name="' . $row['name'] . '" />' . "\r\n";
}
$xml .= "</listOfSpecies>";
fwrite($file, $xml);
fclose($file);
Bookmarks