Click to See Complete Forum and Search --> : merge mp3 code bug


sysco
10-19-2005, 11:42 AM
I am new to PHP and really this is my first script. Purpose of the script is merge a series of mp3 files. I didn’t have any trouble until I pulled values from my SQL database. my hard coded value ($hardString) executes the system command with no problem. It generates my output mp3 with no issues. But when I try to use the data pulled the my SQL DB ($commandString)...the code generates a 0KB mp3 and loads the output file into the browser window (garbled text). Both $hardString / $commandString are identical when I use to echo to display their values. Any suggestions? Thanks!

Apache/1.3.33 (Darwin) PHP/4.3.11
/////CODE EXcerpt/////

$commandString;
$someval;
$outputFile = time() . '.mp3';
$i = 0;


while($myrow = mysql_fetch_row($result)) {

$data = $myrow[0];

$commandString = $commandString . " " . $data;
$i = $i +1;


}

$hardString = 'cat silence.mp3 file1.mp3 file2.mp3 file3.mp3 file4.mp3' . '>' . $outputFile;

$commandString = 'cat' . $commandString . '>' . $outputFile;

system($commandString,$someval);
system($hardString,$someval);

////END CODE///////////