开发者

parts of my php code is displayed in browser

My php code is being displayed in the browser but only after the first echo is called leaving this output in the browser

"; while($row=mysql_fetch_array($results,MYSQL_ASSOC)){ echo " ".$row['title']; } echo ""; ?>

    <?php
require('settings.php');
?>
<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" type="text/javascript"></script>
    </head>
    <body>
    <?php
        $mysql=mysql_connect(mysql_host, mysql_username, mysql_password, true);
        mysql_select_db(mysql_database, $mysql);
        $mostrecent=mysql_query("SELECT * FROM table ORDER BY date DESC", $mysql);
        $top20=mysql_query("SELECT * FROM table", $mysql);
        mysql_close($mysql);
        echo "<div id=\"mostrecent\">";
        while($row=mysql_fetch_array($results,MYSQL_ASSOC)){
            echo "<br />".$row['title'];
        }
        echo "</div>";
    ?>
    </body>
</html>
开发者_如何学Python

That is my code and those are constants defined in settings.php using define().


You're echoing your divs wrong. Try this:

echo '<div id="mostrecent">';

Do that on all your HTML echoes. Single quotes outside, double quotes inside.


You almost certainly have a quote issue. Check that you are ending a quote with a " character and not some oddball unicode character that looks similar.


chances are you have missed a (double quote) " or a (single quote) somewhere, and it is interpretting the rest of your code as text.

if it were a server configuration issue, none of your php would have been interpretted


ENCODING ERROR, WAS UTF-16 on a server that didn't support UTF-16, re encoded into UTF-8 works perfectly


"; while($row=mysql_fetch_array($results,MYSQL_ASSOC)){ echo "
".$row['title']; } echo ""; ?> 

The above statement doesnot have <?.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜