Search This Blog

include() in php

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


Share Links

Related Posts Plugin for WordPress, Blogger...