If we are keeping any PHP code inside the config.php file then we must use PHP start and end tags in those area ( ). If the file is one step above ( or towards root ) the present directory then we can call the file like this "include/config.php" is the file name config.php inside the directory name include. Please note that here we have used relative path in respect to the script running. This will include the file name config.php of the include directory. It is important to note that when a file is included by using include functions then its is parsed as html mode unless the included file has php start and end tags inside it. All the files in the script can call the file storing database information by using include command and the set of code having all the information about database connection inside the included file gets attached to the main file. This is required where we have a common set of code to be used or any declarations or say the database connection is required for the script. By using PHP include() function and file can be used (included ) to any script or file.
0 Comments
Leave a Reply. |