than as end script

recently after testing my sql query script I came across a problem. The greater than sign in my if statement ended the php and then output the rest of the code as html.

Here is my code. (It's in "poll.html", an html file with php code in it)

<div class="pollcont">
<?php

$pollrow = mysql_query("SELECT * FROM `Activepoll` ORDER BY `id` DESC LIMIT 1");

$rows = mysql_num_rows($pollrow);


if($rows > 0){ Do this stuff }; ?> </div>

Instead of finishing the if statement, 0){ Do this stuff }; ? 0){ Do this stuff }; ? > is output into the browser.

Why is this happening and how can I change this so the script will work?


Your file must have the extension ".php".

What your seeing is your browser treating the PHP open tag "<" to the greater than sign ">" as an HTML element and simply hiding that source code. Its not processing anything while its an html file.

链接地址: http://www.djcxy.com/p/79684.html

上一篇: 我应该把公共静态void main(String [] args)方法放在哪里?

下一篇: 比作为结束脚本