PHP代码显示在浏览器中

Dra*_*ake 2 html php browser database

所以,我正在研究数据库项目,我正在尝试逐步编码.问题是,当我在浏览器中测试php时,它会在我使用" - >"后显示php代码.html打印正确显示,这是在 - >之后的点.

这是php:

<?php 
    function getGraphicNovel(){ 
        include_once("./connect.php"); 
        $db_connection = new mysqli($SERVER, $USERNAME, $PASSWORD, $DATABASE); 
        if (mysqli_connect_errno()) { 
            echo("Can't connect to MySQL Server. Error code: " . mysqli_connect_error()); 
            return null; 
        } 
        $stmt = $db_connection->stmt_init(); 
        $returnValue = "invalid"; 
        if($stmt.prepare("select series from graphic_novel_main natural join graphic_novel_misc")) { 
        $stmt->execute(); 
        $stmt->bind_result($series); 
        while ($stmt->fetch()) { 
            echo "<tr><td>" . $series . "</td></tr>";
        }
        $stmt->close(); 
    } 
    $db_connection->close(); 
} 
getGraphicNovel();
?>
Run Code Online (Sandbox Code Playgroud)

这是该页面的链接.希望它适用于学校网络以外的人.

http://plato.cs.virginia.edu/~paw5k/cainedb/viewall.html

如果有人知道为什么会这样,你的输入会很棒!

按要求:

php -v:

PHP 5.3.2-1ubuntu4.14 with Suhosin-Patch (cli) (built: Feb 11 2012 06:50:46) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Run Code Online (Sandbox Code Playgroud)

dqh*_*cks 5

听起来PHP根本不起作用.您没有看到第一部分的唯一原因是因为您的浏览器正在解析它,就像它是HTML标记一样.