Recommend this page to a friend! |
All requests | > | php8 myqsl_pconnect | > | Request new recommendation | > | Featured requests | > | No recommendations |
by Srini Kb - 1 year ago (2023-09-25)
+1 | xampp php 8, mysql_pconnect not working |
1. by ASCOOS CMS - 6 months ago (2024-03-18) Reply
the mysql_pconnect function does not exist in MySQLi.
If you want to use a permanent connection, you can use the mysqli_real_connect function Here an example:
<?php $servername = "localhost"; $username = "username"; $password = "password"; $dbname = "myDB";
// Initialization $conn = mysqli_init();
if (!$conn) {
die('mysqli_init failed');
}
if (!mysqli_real_connect($conn, 'p:' . $servername, $username, $password, $dbname)) {
die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
echo 'Success... ' . mysqli_get_host_info($conn) . "\n";
mysqli_close($conn); ?>
There is also another way to check if there is still a connection, using mysqli_ping.
+1 | by Manuel Lemos 24035 - 11 months ago (2023-11-14) Comment Hello, mysql_pconnect function was removed from PHP before PHP 7. You may want to change your code to use the PHP class above to use mysqli functions instead. |
Recommend package | |
|