PHP code displayed in browser

Posted by Drake on Stack Overflow See other posts from Stack Overflow or by Drake
Published on 2012-04-10T17:13:45Z Indexed on 2012/04/10 17:29 UTC
Read the original article Hit count: 229

Filed under:
|
|
|
|

so, I'm working on a databases project, and i'm trying to code incrementally. the problem is, when i go to test the php in browser, it displays the php code after my use of "->". the html printing is displayed properly, which is AFTER the point where the -> is.

here is the 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();
?>

here is a link to the page. hopefully it works for people outside the school's network.

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

if anyone knows why this is happening, your input would be great!

© Stack Overflow or respective owner

Related posts about php

Related posts about html