2012-11-23 5 views
0

MySQLi 클래스를 확장하는 사용자 정의 데이터베이스 클래스가 있습니다.클래스 확장에서 MySQLi 오류 받기

__construct 메서드에서 parent을 사용하여 데이터베이스에 연결합니다.

다음은 쿼리가 성공적이지 않은 경우 쿼리의 일부입니다. 서버에서 오류를 반환하려면 어떻게해야합니까?

$query = parent::query($querystr, $resultmode); 
    if (!$query) { 
     $error = str_replace(
      'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use', 
      'Syntax Error', 
      mysqli_error(self::getInstance())); 
     \core\debug::sqlerrorlog($error); 
    } else { 
     \core\debug::sqlSuccess(); 
    } 

답변

0

docs에 따르면, 당신은 단지 $this->error 할 필요가있다.

제가 알기로 여러분의 문제는 여러분이 mysqli의 올바른 intsance를 mysql_error으로 넘기지 않는다는 것입니다. 어쩌면 self::getInstance()은 그 일을하지 못하고 있습니다 만, 나는 무엇을 보는지 알 수 없습니다.