0

i am trying to call Procedure but i am getting this error that i mentioned.

exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2053

the following line is what is pointing towards the the error.

$result_new = $this->result->fetchAll(PDO::FETCH_CLASS);

  public function getProcResult($returnKeys = array() ){

            $rows = array();
            $this->result = $this->selectprc();
            $columns = array();
            $key_count = 0;
            $first_call = true;
            do{
                $result_new = $this->result->fetchAll(PDO::FETCH_CLASS);//this is where i am getting the error
                if(isset($returnKeys[$key_count])) {
                    if (count($result_new)) {
                        //print_r($result_new);
                        //echo  $returnKeys[$key_count];
                        //echo '<br>=========<br>';
                        $this->data[$returnKeys[$key_count]] = $result_new;
                    } else {
                        $this->data[$returnKeys[$key_count]] = array();
                    }
                }
                $key_count++;
            }while($this->result->nextRowset());

            do{
                if(isset($returnKeys[$key_count])) {
                    $this->data[$returnKeys[$key_count]] = array();
                }
                $key_count++;
            }while($key_count<count($returnKeys));

            return $this;

        }

   protected  function  selectprc(){
            $pdo = DB::connection($this->connection)->getPdo();
            DB::connection()->logQuery($this->query,array());
            return $pdo->query($this->query);
        }
noobie-php
  • 6,817
  • 15
  • 54
  • 101
  • Did you check https://stackoverflow.com/questions/22423717/mysql-general-error-2053 ? – JérémyCasper Nov 23 '17 at 13:02
  • yes, but as you can see i am not using `fetch_assoc` so quite possibly not a selection issue w.r.t array. – noobie-php Nov 23 '17 at 13:04
  • I'm not used to PDO anymore (with Laravel, I prefere to use Eloquent), but seems you use the query and so you can't fetchall on it (http://php.net/manual/fr/pdo.query.php and the fetchall method http://php.net/manual/fr/pdostatement.fetchall.php who can be used with prepare() and execute() ) – JérémyCasper Nov 23 '17 at 13:07
  • @noobie-php FETCH_CLASS not exist or check naming convention or getting nothing from that class. – Ravi Sharma Nov 23 '17 at 13:07
  • @THERAVI: it exists i just confirmed – noobie-php Nov 23 '17 at 13:10
  • change application/config/database.php file with 'fetch' => PDO::FETCH_CLASS with 'fetch' => PDO::FETCH_ASSOC and then try with FETCH_ASSOC and tell me what you get or checkout this way https://stackoverflow.com/questions/44795215/laravel-5-4-how-to-set-pdo-fetch-mode – Ravi Sharma Nov 23 '17 at 13:15
  • @THERAVI : should i replace whole file with what you mentioned? – noobie-php Nov 23 '17 at 13:19
  • no just this line you got this line 'fetch' => PDO::FETCH_CLASS – Ravi Sharma Nov 23 '17 at 13:19
  • ah its not there mate, but i changed it in the code, where i had it, and its still same. – noobie-php Nov 23 '17 at 13:20
  • Can it be with php version? i have php 5.6.3 on my server? – noobie-php Nov 23 '17 at 13:25

0 Answers0