Simple php DB Connection Function
The following code is a function for database connection in php
Let’s say that you have more than one file to make your queries, in each file you will have to write the same code for database connection, this function will shorten your code and time.
We will have two files
index.php
function.php
Open function.php and write the following code
Open index.php and write the following code
It’s so simple write, now you can call this function in any file.