2013-03-20 1 views
1

이 오류 메시지가 계속 표시되며 이유를 알 수 없습니다. 그것은 로그인 스크립트이고 나는 PHPASS를 사용하여 로그인하는 법을 모르기 때문에 양식 here을 복사했습니다. 당신 have given, 그들은 MySQL의 관련 작업에 대한 MySQLi 연결을 사용하는 링크에서정의되지 않은 메소드 호출 : PDOStatement :: bind_result()?

$email  = ($_POST['email']); 
$pass  = ($_POST['pass']); 

require 'connect.php'; 
require 'PasswordHash.php'; 
$hash = '*'; 
    $login = $con->prepare("SELECT password FROM basicuserinfo WHERE email=:email"); 
    $login->bindParam(':email', $email); 
    $login->execute(); 
    $login->bind_result($hash); 
    if (!$login->fetch() && $con->errno) 
     die(); 
    if ($hasher->CheckPassword($pass, $hash)) { 
     $what = 'Authentication succeeded'; 
    } else { 
     $what = 'Authentication failed'; 
    } 
    unset($hasher); 
+3

'bind_result' 또는'bindResult'는 PDO를 위해 존재하지 않습니다. – hjpotter92

+0

'bind_result()'는'mysqli_statement' 메소드이며, PDO에는 필요하지 않습니다. –

+2

당신이 이해하지 못하는 코드를 복사/붙이기를 권장하지 않습니다. 그것을 읽고, 무슨 일이 일어나고 있는지 알아 내려고 시도한 다음, 디버깅 할 수 있습니다. –

답변

4

: 여기 내 코드입니다. 방법 bind_resultmysqli의 메소드 중 하나입니다.

이것은 MySQL 연결의 방법에서 필요하지 않으며 필요하지 않습니다. PDO 용 list of valid methods/constructors and classes 등입니다.


당신이 대신 여기 사용해야하는 것은 :

fetchColumn는 결과 집합의 다음 행에서 하나의 열을 반환
$hash = $login->fetchColumn(); 

.

+0

고맙습니다. 선생님! –