Ok..i got it so it is echoing the name and the field value, however, it is only doing this for the first array...that is it. This script is driving me up the wall. Can a fresh pair of eyes look at it and tell me why the output is only for the first field name and value. Thanks.
PHP Code:
// output basic header info and beginning of xml tags
$output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
$output .= "<Asset>";
$output .= "<AssetType>";
$output .= "File";
// output basic header info and beginning of xml tags
$result_fld = mysql_query( "Select * FROM file ORDER BY fileid", $dbhandle );
$result_show = mysql_query( "SHOW FIELDS FROM file", $dbhandle );
//count the number of records in the table
$story_total_rows = mysql_num_rows($result_fld);
//build the loop to pull in values for each field
for( $x=0; $x < $story_total_rows; $x++) {
while( $row = mysql_fetch_row($result_fld) ) {
$i=0;
while( $row1 = mysql_fetch_array($result_show) ) {
$output .= "<Field>";
$output .= "<Name>" .$row1[0];
$output .= "</Name>";
$output .= "<Values>";
$output .= "<Value>" .$row[$i] ."</Value>";
$output .= "</Values>";
$output .= "</Field>";
$i++;
}
}
}
$output .= "</AssetType>";
$output .= "</Asset>";
// tell the browser what kind of file is come in
header("Content-type: text/xml");
// print out XML that describes the schema
echo $output;
// close the connection
mysql_close($dbhandle);
?>
Bookmarks