liclude.php :
<?php
mysql_connect('localhost','root','') or die('not connected');
echo '<center>database connected</center>';
?>
=================================================================
index.php :
<?php
@include 'include-page.php';
echo '<br>';
echo 'home page';
?>
output :
database connected
home page=================================================================
sub-page.php :
<?php
@include 'include-page.php';
echo 'sub page';
?>
output :
database connected sub page
=================================================================
note :
' @ ' use for don't display errors related to php
if there is no ' include-page.php ' page then on problem , remaining all are worked
here ' index.php ' , ' sub-page.php ' pages are run
<?php
mysql_connect('localhost','root','') or die('not connected');
echo '<center>database connected</center>';
?>
=================================================================
index.php :
<?php
@include 'include-page.php';
echo '<br>';
echo 'home page';
?>
output :
home page=================================================================
sub-page.php :
<?php
@include 'include-page.php';
echo 'sub page';
?>
output :
=================================================================
note :
' @ ' use for don't display errors related to php
if there is no ' include-page.php ' page then on problem , remaining all are worked
here ' index.php ' , ' sub-page.php ' pages are run