oci_parse() 메서드는 null 구문 분석 메서드를 반환합니다.
P粉043432210
P粉043432210 2024-01-29 13:46:11
0
1
351

몇 가지 OCI 메소드를 사용하여 ORACLE 데이터베이스에 연결하는 클래스를 만들고 싶습니다.

하지만 Parse() 메서드를 호출하면 null이 되고 FetchArray() 메서드는 아무것도 반환하지 않습니다

데이터베이스 PHP 클래스:

으아아아

테스트 페이지.php:

으아아아

현재 데이터베이스 연결에 성공했습니다.

배열 가져오기 방법:

class Database
{
    /**
     * @var string
     */
    private string $login;
    /**
     * @var string
     */
    private string $password;
    /**
     * @var string
     */
    private string $description;
    /**
     * @var
     */
    private $connection;
    /**
     * @var
     */
    private $stmt;

    public function __construct(string $login, string $password, string $description)
    {
        $this->login = $login;
        $this->password = $password;
        $this->description = $description;
    }


    public function Connection($character_set = null, $session_mode = null)
    {
        $this->connection = oci_connect($this->login, $this->password, $this->description, $character_set,    $session_mode);
    }

   
    public function Parse(string $sql)
    {
        $this->stmt = oci_parse($this->connection, $sql);
    }


    public function Execute()
    {
        oci_execute($this->stmt);
    }

P粉043432210
P粉043432210

모든 응답(1)
P粉571233520

문제를 발견한 것 같아요. while 조건에서 행 데이터를 가져온 결과를 부울 false와 비교하기 위해 몇 가지 괄호를 놓쳤을 수 있습니다.

으아아아

이 줄이 업데이트되었습니다:

으아아아

get 함수에서 유형 변환을 제거하는 것도 안전하다고 생각합니다

으아아아
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!