Welcome Guest, Not a member yet? Register   Sign In
Control if query return value
#1

HI i have this query :

Code:
        $this->where('codice_macchina',$codice_bilancia);
        $this->orderBy('id','desc');
        $this->limit(1);

        $bilancia =  $this->first();

        dd($bilancia->countAllResoult());
and return this error:

Code:
Call to a member function countAllResoult() on null

but if i do (by refresh) :

Code:
        $this->where('codice_macchina',$codice_bilancia);
        $this->orderBy('id','desc');
        $this->limit(1);

        $bilancia =  $this->first();

        //dd($bilancia->countAllResoult());

        if(!(is_null($bilancia))) {
         
          echo 'inside if';
          die();

          $bil= explode('_',$bilancia->seriale);
          //$bilancia=5;
          return 'bil_'.$codice_bilancia.'_'.(intval($bil[2]) +1);
       
        }else{
          //$bilancia=4;
          //return $bilancia;
          return 'bil_1'.$codice_bilancia;
        }

It return 'inside if' . Why?
Reply
#2

What is the code in this method:

Code:
$bilancia->countAllResoult());

Looks like a typo to me.
Reply
#3

I think it is method of query Builder
PHP Code:
dd ($this->countAllResults()); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB