Php handles more than at the end of the script

recently after testing my SQL query script, I ran into a problem. The larger the character in my if statement, the php ends, and then the rest of the code is displayed as html.

Here is my code. (This is 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 completing the if statement, the browser displays 0){ Do this stuff }; ? 0){ Do this stuff }; ? >.

Why is this happening and how can I change this to make the script work?

+7
html php apache
source share
1 answer

Your file must have the extension ".php".

What you see in your browser, considering the open PHP tag "<" to the ">" as an HTML element and just hide this source code. Nothing handles it until its html file.

+4
source share

All Articles