<?
//foreach ($fol as $idx => $book)
//  {
//    $fld=`/var/www/html/Bible/audio/`.$book;
//    mkdir($fld);

    $fp2=fopen(`/var/www/html/Bible/audio/Bible2Wav`,`w`);

    $sql=~select book,chapter,verse,text from Bible~;
    $res=GetResultset($sql);
    if (!$res) return false;

    if(!$row = mysql_fetch_row($res)) return false;

    do
      {
           $book=$row[0];
           $chapter=$row[1];
           $verse=$row[2];
           $text=$row[3];
           $in=`/var/www/html/Bible/audio/`.$book.`/`.$book.`_`.$chapter.`-`.$verse.`.txt`;
           SavePage($in,$text,`w`);
           $out=`/var/www/html/Bible/audio/`.$book.`/`.$book.`_`.$chapter.`-`.$verse.`.wav`;
//echo ~out=$out<br>~;
           $str=~text2wave $in -o $out
~;
           fwrite($fp2,$str);
//echo ~str=$str<br>~;
//           echo shell_exec($str);
      }
    while ($row = mysql_fetch_row($res));
    fclose($fp2);
//  }
?>