mysqli_pconnect()
function is used for making a persistent connection with the database that does not terminate when the script ends.
mysqli_connect()
function searches any existing persistence connection first and if no persistence connection exists, then it will create a new database connection and terminate the connection at the end of the script.
Example :
$DBconnection = mysqli_connect("localhost","username","password","dbname");
// Check for valid connection
if (mysqli_connect_errno())
{
echo "Unable to connect with MySQL: " . mysqli_connect_error();
}
mysqli_pconnect() function is depreciated in the new version of PHP, but you can create a persistence connection using mysqli_connect
with the prefix p.