index.php :
<?php
@require 'required-page.php';
echo '<br>';
echo 'home page';
?>
output :
database connected
home page
===========================================================
required-page.php :
<?php
mysql_connect('localhost','root','') or die('not connected');
echo '<center>database connected</center>';
?>
==========================================================
sub-page.php :
<?php
@require 'required-page.php';
echo 'sub page';
?>
output :
database connected sub page
==========================================================
note :
1) ' @ ' use for don't display errors related to php
2) if there is no ' include-page.php ' page then nothing is display in included pages like ' index.php ' , 'sub-page.php '
3) here ' index.php ' , ' sub-page.php ' pages are run
<?php
@require 'required-page.php';
echo '<br>';
echo 'home page';
?>
output :
home page
===========================================================
required-page.php :
<?php
mysql_connect('localhost','root','') or die('not connected');
echo '<center>database connected</center>';
?>
==========================================================
sub-page.php :
<?php
@require 'required-page.php';
echo 'sub page';
?>
output :
==========================================================
note :
1) ' @ ' use for don't display errors related to php
2) if there is no ' include-page.php ' page then nothing is display in included pages like ' index.php ' , 'sub-page.php '
3) here ' index.php ' , ' sub-page.php ' pages are run