I'd use your primary key field (probably called id) to index the array. And use mysql_fetch_assoc, cos we want an array of associative arrays. Like this:
Code:
while ($row = mysql_fetch_assoc($result))
{
$id = $row['id']; // want a globally unique id, assuming primary key is called id
$playlist[$id] = $row; // row is an associative array, so we can now say $playlist[$id]['artist_name'] or whatever
// etc...
}
And (didn't recreate your XML, but to give you the idea):
Code:
foreach($playlist AS $id=>$entry) {
echo "Record ID: $id\n";
echo "Artist: " . $entry['artist_name'] . "\n";
echo "Track: " . $entry['track_name'] . "\n--\n";
}
HTH
Charlie
--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock:
http://charlieharvey.org.uk