We'd love to hear from you! Provide  feedback  to earn a badge today. Take our quick survey
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Fetching more than 10000 rows in PHP Custom Script

Accepted answer
16
Views
1
Comments
edited Dec 5, 2016 8:07AM in Integrations and APIs 1 comment

Content

I am fetching a report in php which has more than 10000 rows.

While i can create a loop and get the data more the rows more than 10000 also, but I am not able to merge the all the rows.

Is there a way in PHP where we can merge the report result?

Code snippet given below.
    

Version

May 2015

Code Snippet

              $nrows=0;
 $mergearr=NULL;
 $start =0;
 $limit = 9999;
 $var=1;
 while($nrows>=0)
 {
$filters= NULL;
$ar= RNCPHP\AnalyticsReport::fetch(104433); //fetch(104434);
$arr= $ar->run($start,$filters,$limit);
	$nrows= $arr->count();
  if($nrows>0)
  {
   if($var==1)
	{
	$mergearr=$arr;
	$var=2;
	}
	else
	{
	$mergearr= array_merge($mergearr,$arr);
	}
	$start=$start+10000;
  }
 if($nrows<$limit)
	{
	$nrows=-1;
	}
}
$nrowsmer= $mergearr->count();
echo("Final rows ".$nrowsmer);  
        

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!