将PHP 5.x迁移到PHP 7.x

我已经更改了PHP 7.x中的所有参数,例如“ mysqli_connect”和另一个参数。 但是它仍然给我关于数据库连接的致命错误。 我的问题在哪里?

我的PHP 5.0代码没有任何变化:

<?php 

$dbh2 = @mysql_connect("$serverdb2","$usernamedb2","$passworddb2", true)or die("Can't Connect To Server, please try again later."); 

@mysql_select_db("$db_conn2", $dbh2) or die("Can't Connect To DataBase, please try again later.");

//Function to sanitize values received from the form. Prevents SQL injection
    function clean($str) {
        $str = @trim($str);
        if(get_magic_quotes_gpc()) {
            $str = stripslashes($str);
        }
        return mysql_real_escape_string($str);
    }
?>
评论