Include in php :
Include in PHP
it minimizes the time as we need to keep a page and if we need that whole block of code we can just include using the syntax: <?php include 'filename.php/html' ?>
so whole code which is written in filename.php/html will be included in that page as u required by using the include keyword in PHP.
example :
connection.php (page 1)
<code>
<?php
$servername="localhost";
$username="root";
$password=" ";
$dbname="database_name";
$conn=mysqli_connect($servername,$username,$password,$dbname);
if(!$conn)
{
echo "connection failed ";
}
else
{
echo "connection Sucessfull !!!";
}
?>
new page:index.php
<?php include 'connection.php' ?>
than start with your php coding here again without writing whole connection code again and again.
<?php
-inser query
-delete query
-display query
-update query
?>
-Puran Kharka
Comments
Post a Comment