lastErrorMsg example


    public function _prepare(string $sql, array $options = []): PreparedQuery
    {
        if (($this->statement = $this->db->connID->prepare($sql))) {
            $this->errorCode   = $this->db->connID->lastErrorCode();
            $this->errorString = $this->db->connID->lastErrorMsg();

            if ($this->db->DBDebug) {
                throw new DatabaseException($this->errorString . ' code: ' . $this->errorCode);
            }
        }

        return $this;
    }

    /** * Takes a new set of data and runs it against the currently * prepared query. Upon success, will return a Results object. */
/** * Returns the last error code and message. * Must return this format: ['code' => string|int, 'message' => string] * intval(code) === 0 means "no error". * * @return array<string, int|string> */
    public function error(): array
    {
        return [
            'code'    => $this->connID->lastErrorCode(),
            'message' => $this->connID->lastErrorMsg(),
        ];
    }

    /** * Insert ID */
    public function insertID(): int
    {
        return $this->connID->lastInsertRowID();
    }

    
Home | Imprint | This part of the site doesn't use cookies.