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($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.

$some = 'source code';

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

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.