Mysql_pconnect alternative in order to work
<p>So I know that mysql_pconnect is deprecated, is there a way actually to make this work, I have an old script which in the connection file has the following:</p>

<pre><code>$success = mysql_pconnect ($mysql_host, $mysql_user, $mysql_password);
if (!$success)
    die ("&lt;b&gt;Cannot connect to database, check if username, password and host are correct.&lt;/b&gt;");
$success = mysql_select_db ($database);
if (!$success) {
    print "&lt;b&gt;Cannot choose database, check if database name is correct.";
    die();
}
</code></pre>

<p>Do I have an alternative to this?</p>

<p>//LE</p>

<pre><code>try {
    $success = new PDO("mysql:host=$mysql_host;dbname=$database", $mysql_user, $mysql_password, array(PDO::ATTR_PERSISTENT=&gt;true));
} catch (PDOException $e) {
    die ("&lt;b&gt;Cannot connect to database, check if username, password and host are correct.&lt;/b&gt;");
}

$success = mysql_select_db ($database);
if (!$success) {
    print "&lt;b&gt;Cannot choose database, check if database name is correct.";
    die();
}
</code></pre>

<p>this gives me "Cannot choose database, check if database name is correct."</p>