• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Message: Call to a member function row() on bool

#1
Sad 
Hello guys, 

I have using Amazon AWS, and wasnt having any problem, but in order to save some money I tried InfinityFree and I'm getting this error.

The error:
An uncaught Exception was encountered
Type: Error
Message: Call to a member function row() on bool
Filename: htdocs/application/models/Twilio_model.php
Line Number: 32
Backtrace:
               File: htdocs/application/controllers/Auth.php
               Line: 705
               Function: send_sms

               File: htdocs/index.php
               Line: 318
               Function: require_once

A PHP Error was encountered
Severity: Warning
Message: session_write_close(): Failed to write session data using user defined save handler. (session.save_path: /php_sessions)
Filename: Unknown
Line Number: 0
Backtrace:

Fatal error: Uncaught Error: Call to a member function row() on bool in htdocs/system/libraries/Session/drivers/Session_database_driver.php:424
Stack trace: #0 /htdocs/system/libraries/Session/drivers/Session_database_driver.php(281): CI_Session_database_driver->_release_lock()
#1 [internal function]: CI_Session_database_driver->close()
#2 [internal function]: session_write_close()
#3 {main} thrown in 
htdocs/system/libraries/Session/drivers/Session_database_driver.php on line 424


The code of the Twilio_model.php

<?php
defined('BASEPATH') or exit('No direct script access allowed');
// Load the autuloader
require_once FCPATH . './vendor/autoload.php';
use Twilio\Rest\Client;

class Twilio_model extends CI_Model {
    
    private $sid;
    private $token;
    public function __construct()
    {
        parent::__construct();
        $this->db->select('*');
        $this->db->from('tbl_addons_api');
        $this->db->where('name''Twilio');
        $query = $this->db->get();

        //SID and Token Info
        $this->SID = $query->row('public_key');
        $this->token = $query->row('secret_key');

    }

    public function send_sms($phone$body)
    {
        $this->db->select('*');
        $this->db->from('tbl_settings');
        $this->db->where('type''sms_active');
        $result = $this->db->get();

        if($result->row('value') != 0) {
            $this->db->select('*');
            $this->db->from('tbl_settings');
            $this->db->where('type''sms_phone');
            $from_number = $this->db->get()->row('value');

            // Reciever's phone number
            $phone_number = $phone;

            // Create Twilio client
            $client = new Client($this->SID$this->token);

            try{
                $client->messages->create(
                $phone_number,
                  array(
                      'from' => $from_number,
                      'body' => $body
                  )
                );
                //sent successfully
                $response = TRUE;
            }catch(Exception $e){
                //echo $e->getCode() . ' : ' . $e->getMessage()."<br>";
                $response = FALSE;
            }

            return $response;
        }
    }

}
And Session_database_driver.php from line 406

// ------------------------------------------------------------------------

    /**
     * Release lock
     *
     * Releases a previously acquired lock
     *
     * @return  bool
     */
    protected function _release_lock()
    {
        if ( ! $this->_lock)
        {
            return TRUE;
        }

        if ($this->_platform === 'mysql')
        {
            //print_r($result);
            if ($this->_db->query("SELECT RELEASE_LOCK ( '".$this->_lock."' ) AS ci_session_lock")->row()->ci_session_lock)
            {
                $this->_lock = FALSE;
                return TRUE;
            }

            return FALSE;
        }
        elseif ($this->_platform === 'postgre')
        {
            if ($this->_db->simple_query('SELECT pg_advisory_unlock('.$this->_lock.')'))
            {
                $this->_lock = FALSE;
                return TRUE;
            }

            return FALSE;
        }

        return parent::_release_lock();
    }
}

I think thats enough and hope somebody can help me out
Reply

#2
->get() can return boolean value
Reply

#3
(03-02-2021, 12:12 PM)iRedds Wrote: ->get() can return boolean value
Yeah, so what happened is that, it was an database with mysql problem, which it closes the connection in the middle of the command..
so ->get() wasnt receiving anything, and apparently Infinityfree doesnt not let change the time out of the connection.

Thanks anyways Big Grin
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.