2009-10-28 2 views
0

난이 (가) MySQL의 DB에서 사용자 세부 사항을 선택 PHP 코드가서버 오류! 나는에서 테스트하려고하지만 때,

$mysql = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database'); 
$stmt = $mysql->prepare('SELECT personalinfo.userid, personalinfo.firstname, personalinfo.lastname FROM personalinfo INNER JOIN applications ON personalinfo.userid = applications.userid WHERE applications.jobref = ?'); 
$stmt->bind_param('i',$jr); 
$stmt->execute(); 
$stmt->store_result(); 
$stmt->bind_result($userID,$firstName,$lastName); 
$count = $stmt->num_rows(); 

내가 및 localY이 코드를 테스트 잘 작동에 한 다음 한 간단한 PHP mysqli를 통해 눈의 또 다른 설정이 필요 라이브 서버, 나는 다음과 같은 오류를 "치명적인 오류 : C에서 비 객체() 멤버 함수의 bind_param에 전화 : 디렉토리 \ 수 \ 경로 \"가 계속 진행 친구들의

들으을

아론

이후 $stmt->bind_param()가 아닌 전화를 할 때 당신이 "비 객체"오류가 발생하는 이유 오류, 발생했을 경우

는 모든

+0

내가 내 테이블의 몇 잠겨 있었다 내 눈을 – Xinus

답변

3

음, mysqli::prepare()의 문서에 따르면, FALSE를 반환합니다 이 시점에서의 객체.

현재 오류 및 향후 오류 때문에 문 작성시 오류가 있는지 확인하고 이에 따라 조치하십시오.

$mysql = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database'); 
$stmt = $mysql->prepare('SELECT personalinfo.userid, personalinfo.firstname, personalinfo.lastname FROM personalinfo INNER JOIN applications ON personalinfo.userid = applications.userid WHERE applications.jobref = ?'); 

if ($stmt) 
{ 
    $stmt->bind_param('i',$jr); 
    $stmt->execute(); 
    $stmt->store_result(); 
    $stmt->bind_result($userID,$firstName,$lastName); 
    $count = $stmt->num_rows(); 
} else { 
    // something went wrong 
    // perhaps display the error? 
    echo $mysql->error; 
} 
+0

들으 피터를 사랑 할 수 없습니다 내가 캐치 오류가 더 도움이 구조를 사용합니다, 모두가 잘 이제 S/빨리 미래에 감사 muchos :) 아론 –