Newbie

i have been learning php recently, but just to ask a novice question, i have a prototype website in xhtml, just thinking if i change the file name to .php, what should be the outcome(though i have done that, it came back with nothing, can u please give me a technical reason, and what do you advise)

do you have php installed?

If PHP is installed correctly, Apache will send the file to the PHP parser for parsing, then do whatever it would normally do with HTML.

yes, i have php instaled, but did not give anything back, could it be because of the doc type declared
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

get the PHP installer and then you can easily change the domain name with .php

“Did not give anything back”? As in a white screen of nothingness?

This is what PHP developers call “I’ve got an error but i’ve got display_errors disabled”.

Just to say that if you DO have PHP running, with Apache, then one can tell apache to process all .html files as PHP - or any file-type, eg .asp.

Most of my sites are .htm to the naked eye but act and behave as .php files*

I am not saying this is your best option, just throwing it out there for anyone else reading this - in case you did not want to risk upsetting the SEO gods.

Off Topic:

At a very large site I converted from asp to php we used the same trick and it was with great satisfaction we watched all the script-kiddy probes continue to target known .asp frailties.

actually, i did some spelling mistakes, which i have corrected in the mark up, but i am having the error , database query failed , here is my mark up below.


error_reporting(E_ALL); 
ini_set('display_errors',1);
<?php
	//1.create database connection
	$connection = mysql_connect("localhost","root","password");
	if (!$connection) {
		die("Database connection failed: " . mysql_error());
		}
		//2 select database to use
	$db_select = mysql_select_db("reacheasy","connection");
	if ($db_select) {
		die("Database selection failed: " . mysql_error());
		}
		?>
<?php require_once("include/functions.php"); ?>
<?php include("include/header.php"); ?>
<div id="navigation">
<ul>
<li>
    
    <?php
	//3. perform database querry
	$result = mysql_query("SELECT * FROM subjects", $connection);
	if (!$result) {
		die("Database query failed: " . mysql_error());
		}
		//4 use returned data
	while($row = mysql_fetch_array($result)) {
		echo $row["menu_name"]." ".$row["position"]."<br />";
		}
		?>
	</li>	
</ul>
</div> <!--end of navigation div -->
<div id="bodycontent">
<h3> content area</h3>
<p> i hope this works. </p>
</div>
<?php include("include/footer.php"); ?>
<?php
	//5. close connection
	mysql_close($connection);
	?>

did you notice any wrong thing, i have checked my database and subjects is there


    $db_select = mysql_select_db("reacheasy",$connection);

PHP: mysql_select_db - Manual

actually , i have found where the problem is
if ($db_select) {
die("Database selection failed: " . mysql_error());
its suppose to be
(!$db_select)