Hi all .I wonder how i can write the file path and file name that i read from mp3 folder and write them to mysql database table. Currently print_r($playlist); outputs the file names with .mp3 extention as shown below .Furthermore,print_r(htmlentities($code)) output path and file title as shown below. I be happy if an expert show me how i can write the file name and file path and write them to mysql db with file number.Thanks

Code:
<?php

// setting the directory to search for mp3 files
$dir = "mp3/";

// reading the directory and inserting the mp3 files in the playlist array
$n = 0;
$playlist = array();
$fdir = opendir($dir);
while($i = readdir($fdir)) {
   // if a .mp3 string is found, add the file to the array
   if (strpos(strtolower($i),".mp3") !== false) {
  	   $playlist[$n] = $i;
  	   $n++;
  	} 
}
// close the directory and sort the array
closedir($fdir);
array_multisort($playlist);

print_r($playlist);

// echoing the playlist to flash
 $code = "<player showDisplay=\"yes\" showPlaylist=\"no\" autoStart=\"yes\">\n";
 for ($i=0; $i<sizeof($playlist); $i++) {
   // for the title it filters the directory and the .mp3 extension out
    $code .= "  <song path=\"$dir.$playlist[$i]\" title=\"".str_replace(".mp3","",$playlist[$i])."\"  />\n";
 }
 $code .= "</player>";

print_r(htmlentities($code));
?>
print_r($playlist); output
Code:
Array ( 

[0] => songname1.mp3 
[1] => songname2.mp3 
[2] => songname3.mp3 
[3] => songname4.mp3 
[4] => songname5.mp3 
[5] => songname6.mp3 
[6] => songname7.mp3 
[7] => songname8.mp3 
[8] => songname9.mp3 
[9] => songname10.mp3 
[10] => songname11.mp3 
[11] => songname12.mp3 
)
print_r(htmlentities($code)); output
Code:
<player showDisplay="yes" showPlaylist="no" autoStart="yes"> 
<song path="mp3/songname1.mp3" title="songname1" /> 
<song path="mp3/songname2.mp3" title="songname2" />
.
.
.
 </player>