Skip to content

Instantly share code, notes, and snippets.

@Arkango
Created July 23, 2019 17:42
Show Gist options
  • Save Arkango/2158a2b0eb05f2092ae54ac258e0f391 to your computer and use it in GitHub Desktop.
Save Arkango/2158a2b0eb05f2092ae54ac258e0f391 to your computer and use it in GitHub Desktop.
<?php
function getCountByField($year,$field,$interessato_a = ''){
$acceptable = ["citta","provincia" ,"source_potential" ,"campagna" ];
if(in_array($acceptable,strtolower($field))){
$whereClause = ($interessato_a == '') ? '' : " and interessato_a = ".$interessato_a;
return GQD('fl_leads_hrc',$field.", count(*) as cnt ","year(data_creazione) = ".$year." ".$whereClause." GROUP BY ".$field);
}else{
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment