php database query fails within drupal 8

I recently converted a website to Drupal 8.5.1.

As part of the original website, there was a php file that did a database query and displayed the results.  I executed it from a simple HTML link, i.e. <a href=”MyPhpQuery.php”>List by title of the composition</a>.

When I run that same .php file from a link in a page within the new D8 site, I just get a white screen and nothing gets displayed.

The database hasn’t changed and the .php file worked fine for years, so I feel there must be something simple I’m missing of how to do such a task from within a Drupal site.

If anyone could point me in a helpful direction, I’m be much appreciative.

If it helps, I’ve listed a redacted version of the .php file below.




<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
<meta name=”GENERATOR” content=”Microsoft FrontPage 5.0″>
<meta name=”ProgId” content=”FrontPage.Editor.Document”>
<meta name=”description” content=”Lex-Ham Community Band Music Inventory sorted by title”>
<title>Lex-Ham Community Band Music Inventory by title</title>



$dbh=mysql_connect (‘localhost:3306’, ‘MyID’, ‘MyPassword) or die (‘I cannot connect to the database because: ‘ . mysql_error());

mysql_select_db (“My_MySQLDB”); 

$result = mysql_query(
            “SELECT * FROM My_MySQLDB.MusicInventory ORDER BY title”);
  if (!$result) {
    echo(“<P>Error performing query: ” .
         mysql_error() . “</P>”);

// Determine the number of records returned
$number = mysql_numrows($result);

// Print the relevant information 

print “<h2>Lex-Ham Community Band Music Inventory</h2>
    <table cellpadding=5>
    <tr bgcolor=black>
      <td><font color=white><b>Number</b></font></td>
      <td><font color=white><b>Title</b></font></td>
      <td><font color=white><b>Composer</b></font></td>
      <td><font color=white><b>Arranger</b></font></td>
$recNum = 0;
for($i=0; $i<$number; $i++) {
    $title = mysql_result($result, $i, “title”);
    $composer = mysql_result($result, $i, “composer”);
    $arranger = mysql_result($result, $i, “arranger”);
    /* print even-numbered rows with a grey background, 
           odd-numbered with a white background */
        if ($i%2 == 0) {
        print “<tr bgcolor=lightgrey>”;
        } else {
        print “<tr>”;
    print “<td>$recNum</td>
print “</table>”;



Drupal version: