title: How to show Audio format in PHP page from mysql?
body: <p>Similar types of questions are already asked but none is helpful. I want to display working audio file (.mp3 or .wav) in php page from mysql database. I tried my best but the audio file is not playing., #code1 </p>
  
  <pre><code>&lt;html&gt;
  &lt;form method="post" action="searchbook.php"&gt;
  &lt;div class="search"&gt;
  &lt;input type="text" name="searchword" class="searchTerm"&gt;
  &lt;button type="submit" class="searchButton"&gt;SEARCH&lt;/button&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>From above file I passed user entered value to below searchbook.php file, #code2</p>
  
  <pre><code>&lt;html&gt;
  $searchword=$_POST['searchword'];
  $con=mysqli_connect('localhost','root','','bookspyramid');
  $sql="SELECT audiono FROM bookinfo where bookname like '%$searchword%'";
  if($result=mysqli_query($con,$sql))
  {
    if(mysqli_num_rows($result)&gt;0)
    {
      while($row=mysqli_fetch_array($result))
      {  
        echo "&lt;a href='..\datafile/viewaudio.php?del=$row[audiono]'&gt;Download AudioBook &lt;/a&gt;";
      }
    }
  }
  &lt;/html&gt;
  </code></pre>
  
  <p>From above code I passed value of audiono to below viewaudio php file, #code3</p>
  
  <pre><code>&lt;html&gt;
  &lt;?php
  $remitem=$_GET['del'];
  $con=mysqli_connect('localhost','root','','bookspyramid');
  ?&gt;
  &lt;audio controls style="width: 90%; margin-left: 5%;"&gt;
  &lt;source src="data:audio/wav;base64,&lt;?php echo base64_encode($remitem); ?&gt;" type="audio/wav"&gt;
  &lt;/audio&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>If instead of just above code I write below code then file successfully gets downloaded, #code4</p>
  
  <pre><code>&lt;?php
      $remitem=$_GET['del'];
      header('Content-type: application/audio');
      header('Content-Disposition: inline; filename="' . $remitem . '"');
      header('Content-Transfer-Encoding: binary');
      header('Accept-Ranges: bytes');
      @readfile($remitem);
  ?&gt;
  </code></pre>
  
  <p>But if I want to show the audio format(online play). In Edge it is displaying 'This type of audio file isn't supported'</p>
  
  <p>In output of #code3, audiofile is showing but it is not working(gray in colour). I want it to work.</p>