Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to display more than 40 columns data using PHQL?

Hi There,

I have 11432 records with 59 columns. When i use PHQL to display all data with 41 column it will return nothing.not even error. but when i use all data with 40 columns, it will return as expected. Why PHQL is not returning more than 40 columns data?

public function getManyByPHQL($tablename,$columnarr = []){

$columnname = "*"; if(count($columnarr) >0){ $columnname = implode(",", $columnarr); }

$qry = "SELECT $columnname FROM ".$tablename; $query = new Query($qry, $this->getDI());

$records = $query->execute(); return $records; }

// Now i call above function as below

$column = ['publicationid','publication','publicationcode','pubkey0','pubcompanyid','abcapproved','agencycommision','categoryid','categorycode','circulation','circulationdate','cityid','citycode','closedate','currencyid','currencycode','davpallowed','discountallowed','formtype','frequencyid','frequencycode','frequencyweekdays','frequencydate','frequencydescription','insapproved','languageid','languagecode','launchdate','leadtimebw','leadtimecolor','stitchid','stitchcode','concessionaireid','concessionairecode','markettingexecutive','marketingofficeaddress','marketingadvtperson','marketingceogm','marketingeditorperson','marketingemail','marketingtelephone','marketingfax','marketingurl','parentpublicationid','parentpublicationcode','publicationlevel','publicationstatus','publicationtype','surchargebasis','publicationeditioncount','main_genre'];

$table_name = "publications";

$recordsbasemodel = $this->getManyByPHQL($table_name, $column);

if (count($recordsbasemodel) > 0) { foreach ($recordsbasemodel as $record) { $data['result_set'][] = $record->toArray(); }

print_r($data); }

It will display nothing. if i use only 40 column than it will display all the records. Why this happens?

edited Jun '16

First of all, when you post source code try putting it in code blocks, so we can actually read what you're trying to do.

$some = 'source code';

Phalcon does not impose any limit on column count, your error will be in your custom getManyByPHQLfunction

edited Jun '16

Hi There,

There is no error in custom function. I already mentioned that it will return all data with 40 column but not more than 40 columns.

I fond solution. which is when i use toArray(). It does not convert special it will not generate error and breaks the loop. may be UTF-8 charactor set issue.