Call to a member function bindParam() on a non-object

前端 未结 1 1372
时光取名叫无心
时光取名叫无心 2020-12-12 03:04

I\'m working a log-in script that I found on the web. (http://alias.io/2010/01/store-passwords-safely-with-php-and-mysql/)

As I was trying to make it work, I stumble

相关标签:
1条回答
  • 2020-12-12 03:52

    your connection object is mysqli, you should use PDO to connect mysql like

    $dsn = 'mysql:dbname=testdb;host=127.0.0.1';
    $user = 'dbuser';
    $password = 'dbpass';
    
    try {
        $dbh = new PDO($dsn, $user, $password);
    } catch (PDOException $e) {
        echo 'Connection failed: ' . $e->getMessage();
    }
    
    0 讨论(0)
提交回复
热议问题