0

Error: Uncaught Error: Call to undefined method mysqli_stmt::get_result()

How to use it right?

    public static function login($benutzername, $passwort){
        $result = Connection::getInstance()->db;
        $sql = 'SELECT * FROM users WHERE benutzername = ? AND passwort = ?';
        $stmt = $result->prepare($sql);
        $passwort = md5($passwort);

maybe use mysqli-stmt.bind-result ?

        $stmt->bind_param('ss', $benutzername, $passwort);
        $stmt->execute();
        $result = $stmt->get_result();

or mysqli_stmt_fetch?

        if ($result->num_rows != '0') {}

Thanks a lot!

  • 1
    you tagged as pdo but using mysqli_, why? and what is the connection, pdo or mysqli_? – Funk Forty Niner May 07 '18 at 14:23
  • 1
    you're using md5 to store passwords with? in this day and age? that's over 30 years ago and it's too old and broken; use password_hash(). – Funk Forty Niner May 07 '18 at 14:24
  • https://stackoverflow.com/questions/8321096/call-to-undefined-method-mysqli-stmtget-result – Felippe Duarte May 07 '18 at 14:25
  • `Available only with mysqlnd.` Make sure you have mysqlnd installed. – aynber May 07 '18 at 14:26
  • and I added another (possible) duplicate to the one that was chosen by others. – Funk Forty Niner May 07 '18 at 14:28
  • wee bit of a pro side note: when people type a comment to you, it would help everyone to be on the same page and respond. How do you like one-way conversations? Pretty annoying huh? Yeah; I know what you mean, I get those all the time when I talk to a wall. – Funk Forty Niner May 07 '18 at 14:36
  • wanna use pdo, should rename this. mysqlnd is available. i'll try your notices and post the new code below. –  May 07 '18 at 14:57

0 Answers0