We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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($table_name,$column_arr = []){

$column_name = "*"; if(count($column_arr) >0){ $column_name = implode(",", $column_arr); }

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

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

// Now i call above function as below

$column = ['publication_id','publication','publication_code','pub_key_0','pubcompany_id','abc_approved','agency_commision','category_id','category_code','circulation','circulation_date','city_id','city_code','close_date','currency_id','currency_code','davp_allowed','discount_allowed','form_type','frequency_id','frequency_code','frequency_weekdays','frequency_date','frequency_description','ins_approved','language_id','language_code','launch_date','leadtime_bw','leadtime_color','stitch_id','stitch_code','concessionaire_id','concessionaire_code','marketting_executive','marketing_office_address','marketing_advt_person','marketing_ceo_gm','marketing_editor_person','marketing_email','marketing_telephone','marketing_fax','marketing_url','parent_publication_id','parent_publication_code','publication_level','publication_status','publication_type','surcharge_basis','publication_edition_count','main_genre'];

$table_name = "publications";

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

if (count($records_base_model) > 0) { foreach ($records_base_model 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. https://forum.phalcon.io/help/markdown

```php
$some = 'source code';


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


5.6k
Accepted
answer
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 charactor.so it will not generate error and breaks the loop. may be UTF-8 charactor set issue.