Forum Moderators: open
any help would be greatfully received:
<?php require_once('Connections/immapp.php'); ?>
<?php
mysql_select_db($database_immapp, $immapp);
$recordID = $_GET['recordID'];
$query_rs_country = "SELECT * FROM artist WHERE location_id_artist = $recordID ORDER BY 'year_artist'";
$rs_country = mysql_query($query_rs_country, $immapp) or die(mysql_error());
$row_rs_country = mysql_fetch_assoc($rs_country); //--- problem here?
$totalRows_rs_country = mysql_num_rows($rs_country); //-- here?
$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<artists>\n";
for($x = 0 ; $x < mysql_num_rows($rs_country) ; $x++){ //--re here?
$row = mysql_fetch_assoc($rs_country); //--- and here?
$xml_output .= "\t<artist>\n";
$xml_output .= "\t\t<Artist_Image>" . $row['imageTB_artist'] . "</Artist_Image>\n";
$xml_output .= "\t\t<Artist_First_Name>" . $row['1stname_artist'] . "</Artist_First_Name>\n";
$xml_output .= "\t\t<Artist_Second_Name>" . $row['2ndname_artist'] . "</Artist_Second>\n";
$xml_output .= "\t\t<Artist_Year>" . $row['year_artist'] . "</Artist_Year>\n";
$xml_output .= "\t\t<Artist_Country>" . $row['country_artist'] . "</Artist_Country>\n";
$xml_output .= "\t</artist>\n <br />";
}
$xml_output .= "</artists>";
$filename = 'XML-ARTIST_COUNTRY.xml';
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'w')) {
echo "Cannot open ($filename)";
exit;
}
if (fwrite($handle, $xml_output) === FALSE) {
echo "Cannot write to ($filename)";
exit;
}
echo "Success, wrote <br> ($xml_output) to ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>
----
thanks
milo